Changeset 60948
- Timestamp:
- 10/16/2025 07:59:11 PM (4 months ago)
- Location:
- trunk
- Files:
-
- 11 edited
-
src/js/_enqueues/vendor/json2.js (modified) (1 diff)
-
src/wp-includes/class-wp-dependencies.php (modified) (1 diff)
-
src/wp-includes/class-wp-scripts.php (modified) (7 diffs)
-
src/wp-includes/class-wp-styles.php (modified) (5 diffs)
-
src/wp-includes/css/wp-embed-template-ie.css (modified) (1 diff)
-
src/wp-includes/embed.php (modified) (1 diff)
-
src/wp-includes/functions.wp-scripts.php (modified) (1 diff)
-
src/wp-includes/functions.wp-styles.php (modified) (2 diffs)
-
src/wp-includes/script-loader.php (modified) (7 diffs)
-
tests/phpunit/tests/dependencies/scripts.php (modified) (5 diffs)
-
tests/phpunit/tests/dependencies/styles.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/vendor/json2.js
r43309 r60948 1 /* 2 json2.js 3 2015-05-03 4 5 Public Domain. 6 7 NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. 8 9 See http://www.JSON.org/js.html 10 11 12 This code should be minified before deployment. 13 See http://javascript.crockford.com/jsmin.html 14 15 USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO 16 NOT CONTROL. 17 18 19 This file creates a global JSON object containing two methods: stringify 20 and parse. This file is provides the ES5 JSON capability to ES3 systems. 21 If a project might run on IE8 or earlier, then this file should be included. 22 This file does nothing on ES5 systems. 23 24 JSON.stringify(value, replacer, space) 25 value any JavaScript value, usually an object or array. 26 27 replacer an optional parameter that determines how object 28 values are stringified for objects. It can be a 29 function or an array of strings. 30 31 space an optional parameter that specifies the indentation 32 of nested structures. If it is omitted, the text will 33 be packed without extra whitespace. If it is a number, 34 it will specify the number of spaces to indent at each 35 level. If it is a string (such as '\t' or ' '), 36 it contains the characters used to indent at each level. 37 38 This method produces a JSON text from a JavaScript value. 39 40 When an object value is found, if the object contains a toJSON 41 method, its toJSON method will be called and the result will be 42 stringified. A toJSON method does not serialize: it returns the 43 value represented by the name/value pair that should be serialized, 44 or undefined if nothing should be serialized. The toJSON method 45 will be passed the key associated with the value, and this will be 46 bound to the value 47 48 For example, this would serialize Dates as ISO strings. 49 50 Date.prototype.toJSON = function (key) { 51 function f(n) { 52 // Format integers to have at least two digits. 53 return n < 10 54 ? '0' + n 55 : n; 56 } 57 58 return this.getUTCFullYear() + '-' + 59 f(this.getUTCMonth() + 1) + '-' + 60 f(this.getUTCDate()) + 'T' + 61 f(this.getUTCHours()) + ':' + 62 f(this.getUTCMinutes()) + ':' + 63 f(this.getUTCSeconds()) + 'Z'; 64 }; 65 66 You can provide an optional replacer method. It will be passed the 67 key and value of each member, with this bound to the containing 68 object. The value that is returned from your method will be 69 serialized. If your method returns undefined, then the member will 70 be excluded from the serialization. 71 72 If the replacer parameter is an array of strings, then it will be 73 used to select the members to be serialized. It filters the results 74 such that only members with keys listed in the replacer array are 75 stringified. 76 77 Values that do not have JSON representations, such as undefined or 78 functions, will not be serialized. Such values in objects will be 79 dropped; in arrays they will be replaced with null. You can use 80 a replacer function to replace those with JSON values. 81 JSON.stringify(undefined) returns undefined. 82 83 The optional space parameter produces a stringification of the 84 value that is filled with line breaks and indentation to make it 85 easier to read. 86 87 If the space parameter is a non-empty string, then that string will 88 be used for indentation. If the space parameter is a number, then 89 the indentation will be that many spaces. 90 91 Example: 92 93 text = JSON.stringify(['e', {pluribus: 'unum'}]); 94 // text is '["e",{"pluribus":"unum"}]' 95 96 97 text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); 98 // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' 99 100 text = JSON.stringify([new Date()], function (key, value) { 101 return this[key] instanceof Date 102 ? 'Date(' + this[key] + ')' 103 : value; 104 }); 105 // text is '["Date(---current time---)"]' 106 107 108 JSON.parse(text, reviver) 109 This method parses a JSON text to produce an object or array. 110 It can throw a SyntaxError exception. 111 112 The optional reviver parameter is a function that can filter and 113 transform the results. It receives each of the keys and values, 114 and its return value is used instead of the original value. 115 If it returns what it received, then the structure is not modified. 116 If it returns undefined then the member is deleted. 117 118 Example: 119 120 // Parse the text. Values that look like ISO date strings will 121 // be converted to Date objects. 122 123 myData = JSON.parse(text, function (key, value) { 124 var a; 125 if (typeof value === 'string') { 126 a = 127 /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); 128 if (a) { 129 return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], 130 +a[5], +a[6])); 131 } 132 } 133 return value; 134 }); 135 136 myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { 137 var d; 138 if (typeof value === 'string' && 139 value.slice(0, 5) === 'Date(' && 140 value.slice(-1) === ')') { 141 d = new Date(value.slice(5, -1)); 142 if (d) { 143 return d; 144 } 145 } 146 return value; 147 }); 148 149 150 This is a reference implementation. You are free to copy, modify, or 151 redistribute. 152 */ 153 154 /*jslint 155 eval, for, this 156 */ 157 158 /*property 159 JSON, apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, 160 getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, 161 lastIndex, length, parse, prototype, push, replace, slice, stringify, 162 test, toJSON, toString, valueOf 163 */ 164 165 166 // Create a JSON object only if one does not already exist. We create the 167 // methods in a closure to avoid creating global variables. 168 169 if (typeof JSON !== 'object') { 170 JSON = {}; 171 } 172 173 (function () { 174 'use strict'; 175 176 var rx_one = /^[\],:{}\s]*$/, 177 rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, 178 rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, 179 rx_four = /(?:^|:|,)(?:\s*\[)+/g, 180 rx_escapable = /[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, 181 rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; 182 183 function f(n) { 184 // Format integers to have at least two digits. 185 return n < 10 186 ? '0' + n 187 : n; 188 } 189 190 function this_value() { 191 return this.valueOf(); 192 } 193 194 if (typeof Date.prototype.toJSON !== 'function') { 195 196 Date.prototype.toJSON = function () { 197 198 return isFinite(this.valueOf()) 199 ? this.getUTCFullYear() + '-' + 200 f(this.getUTCMonth() + 1) + '-' + 201 f(this.getUTCDate()) + 'T' + 202 f(this.getUTCHours()) + ':' + 203 f(this.getUTCMinutes()) + ':' + 204 f(this.getUTCSeconds()) + 'Z' 205 : null; 206 }; 207 208 Boolean.prototype.toJSON = this_value; 209 Number.prototype.toJSON = this_value; 210 String.prototype.toJSON = this_value; 211 } 212 213 var gap, 214 indent, 215 meta, 216 rep; 217 218 219 function quote(string) { 220 221 // If the string contains no control characters, no quote characters, and no 222 // backslash characters, then we can safely slap some quotes around it. 223 // Otherwise we must also replace the offending characters with safe escape 224 // sequences. 225 226 rx_escapable.lastIndex = 0; 227 return rx_escapable.test(string) 228 ? '"' + string.replace(rx_escapable, function (a) { 229 var c = meta[a]; 230 return typeof c === 'string' 231 ? c 232 : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); 233 }) + '"' 234 : '"' + string + '"'; 235 } 236 237 238 function str(key, holder) { 239 240 // Produce a string from holder[key]. 241 242 var i, // The loop counter. 243 k, // The member key. 244 v, // The member value. 245 length, 246 mind = gap, 247 partial, 248 value = holder[key]; 249 250 // If the value has a toJSON method, call it to obtain a replacement value. 251 252 if (value && typeof value === 'object' && 253 typeof value.toJSON === 'function') { 254 value = value.toJSON(key); 255 } 256 257 // If we were called with a replacer function, then call the replacer to 258 // obtain a replacement value. 259 260 if (typeof rep === 'function') { 261 value = rep.call(holder, key, value); 262 } 263 264 // What happens next depends on the value's type. 265 266 switch (typeof value) { 267 case 'string': 268 return quote(value); 269 270 case 'number': 271 272 // JSON numbers must be finite. Encode non-finite numbers as null. 273 274 return isFinite(value) 275 ? String(value) 276 : 'null'; 277 278 case 'boolean': 279 case 'null': 280 281 // If the value is a boolean or null, convert it to a string. Note: 282 // typeof null does not produce 'null'. The case is included here in 283 // the remote chance that this gets fixed someday. 284 285 return String(value); 286 287 // If the type is 'object', we might be dealing with an object or an array or 288 // null. 289 290 case 'object': 291 292 // Due to a specification blunder in ECMAScript, typeof null is 'object', 293 // so watch out for that case. 294 295 if (!value) { 296 return 'null'; 297 } 298 299 // Make an array to hold the partial results of stringifying this object value. 300 301 gap += indent; 302 partial = []; 303 304 // Is the value an array? 305 306 if (Object.prototype.toString.apply(value) === '[object Array]') { 307 308 // The value is an array. Stringify every element. Use null as a placeholder 309 // for non-JSON values. 310 311 length = value.length; 312 for (i = 0; i < length; i += 1) { 313 partial[i] = str(i, value) || 'null'; 314 } 315 316 // Join all of the elements together, separated with commas, and wrap them in 317 // brackets. 318 319 v = partial.length === 0 320 ? '[]' 321 : gap 322 ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' 323 : '[' + partial.join(',') + ']'; 324 gap = mind; 325 return v; 326 } 327 328 // If the replacer is an array, use it to select the members to be stringified. 329 330 if (rep && typeof rep === 'object') { 331 length = rep.length; 332 for (i = 0; i < length; i += 1) { 333 if (typeof rep[i] === 'string') { 334 k = rep[i]; 335 v = str(k, value); 336 if (v) { 337 partial.push(quote(k) + ( 338 gap 339 ? ': ' 340 : ':' 341 ) + v); 342 } 343 } 344 } 345 } else { 346 347 // Otherwise, iterate through all of the keys in the object. 348 349 for (k in value) { 350 if (Object.prototype.hasOwnProperty.call(value, k)) { 351 v = str(k, value); 352 if (v) { 353 partial.push(quote(k) + ( 354 gap 355 ? ': ' 356 : ':' 357 ) + v); 358 } 359 } 360 } 361 } 362 363 // Join all of the member texts together, separated with commas, 364 // and wrap them in braces. 365 366 v = partial.length === 0 367 ? '{}' 368 : gap 369 ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' 370 : '{' + partial.join(',') + '}'; 371 gap = mind; 372 return v; 373 } 374 } 375 376 // If the JSON object does not yet have a stringify method, give it one. 377 378 if (typeof JSON.stringify !== 'function') { 379 meta = { // table of character substitutions 380 '\b': '\\b', 381 '\t': '\\t', 382 '\n': '\\n', 383 '\f': '\\f', 384 '\r': '\\r', 385 '"': '\\"', 386 '\\': '\\\\' 387 }; 388 JSON.stringify = function (value, replacer, space) { 389 390 // The stringify method takes a value and an optional replacer, and an optional 391 // space parameter, and returns a JSON text. The replacer can be a function 392 // that can replace values, or an array of strings that will select the keys. 393 // A default replacer method can be provided. Use of the space parameter can 394 // produce text that is more easily readable. 395 396 var i; 397 gap = ''; 398 indent = ''; 399 400 // If the space parameter is a number, make an indent string containing that 401 // many spaces. 402 403 if (typeof space === 'number') { 404 for (i = 0; i < space; i += 1) { 405 indent += ' '; 406 } 407 408 // If the space parameter is a string, it will be used as the indent string. 409 410 } else if (typeof space === 'string') { 411 indent = space; 412 } 413 414 // If there is a replacer, it must be a function or an array. 415 // Otherwise, throw an error. 416 417 rep = replacer; 418 if (replacer && typeof replacer !== 'function' && 419 (typeof replacer !== 'object' || 420 typeof replacer.length !== 'number')) { 421 throw new Error('JSON.stringify'); 422 } 423 424 // Make a fake root object containing our value under the key of ''. 425 // Return the result of stringifying the value. 426 427 return str('', {'': value}); 428 }; 429 } 430 431 432 // If the JSON object does not yet have a parse method, give it one. 433 434 if (typeof JSON.parse !== 'function') { 435 JSON.parse = function (text, reviver) { 436 437 // The parse method takes a text and an optional reviver function, and returns 438 // a JavaScript value if the text is a valid JSON text. 439 440 var j; 441 442 function walk(holder, key) { 443 444 // The walk method is used to recursively walk the resulting structure so 445 // that modifications can be made. 446 447 var k, v, value = holder[key]; 448 if (value && typeof value === 'object') { 449 for (k in value) { 450 if (Object.prototype.hasOwnProperty.call(value, k)) { 451 v = walk(value, k); 452 if (v !== undefined) { 453 value[k] = v; 454 } else { 455 delete value[k]; 456 } 457 } 458 } 459 } 460 return reviver.call(holder, key, value); 461 } 462 463 464 // Parsing happens in four stages. In the first stage, we replace certain 465 // Unicode characters with escape sequences. JavaScript handles many characters 466 // incorrectly, either silently deleting them, or treating them as line endings. 467 468 text = String(text); 469 rx_dangerous.lastIndex = 0; 470 if (rx_dangerous.test(text)) { 471 text = text.replace(rx_dangerous, function (a) { 472 return '\\u' + 473 ('0000' + a.charCodeAt(0).toString(16)).slice(-4); 474 }); 475 } 476 477 // In the second stage, we run the text against regular expressions that look 478 // for non-JSON patterns. We are especially concerned with '()' and 'new' 479 // because they can cause invocation, and '=' because it can cause mutation. 480 // But just to be safe, we want to reject all unexpected forms. 481 482 // We split the second stage into 4 regexp operations in order to work around 483 // crippling inefficiencies in IE's and Safari's regexp engines. First we 484 // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we 485 // replace all simple value tokens with ']' characters. Third, we delete all 486 // open brackets that follow a colon or comma or that begin the text. Finally, 487 // we look to see that the remaining characters are only whitespace or ']' or 488 // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. 489 490 if ( 491 rx_one.test( 492 text 493 .replace(rx_two, '@') 494 .replace(rx_three, ']') 495 .replace(rx_four, '') 496 ) 497 ) { 498 499 // In the third stage we use the eval function to compile the text into a 500 // JavaScript structure. The '{' operator is subject to a syntactic ambiguity 501 // in JavaScript: it can begin a block or an object literal. We wrap the text 502 // in parens to eliminate the ambiguity. 503 504 j = eval('(' + text + ')'); 505 506 // In the optional fourth stage, we recursively walk the new structure, passing 507 // each name/value pair to a reviver function for possible transformation. 508 509 return typeof reviver === 'function' 510 ? walk({'': j}, '') 511 : j; 512 } 513 514 // If the text is not JSON parseable, then a SyntaxError is thrown. 515 516 throw new SyntaxError('JSON.parse'); 517 }; 518 } 519 }()); 1 // Deprecated in WordPress 6.9. -
trunk/src/wp-includes/class-wp-dependencies.php
r58935 r60948 290 290 return false; 291 291 } 292 if ( 'conditional' === $key && '_required-conditional-dependency_' !== $value ) { 293 _deprecated_argument( 294 'WP_Dependencies->add_data()', 295 '6.9.0', 296 __( 'IE conditional comments are ignored by all supported browsers.' ) 297 ); 298 } 292 299 293 300 return $this->registered[ $handle ]->add_data( $key, $value ); -
trunk/src/wp-includes/class-wp-scripts.php
r60931 r60948 293 293 294 294 $obj = $this->registered[ $handle ]; 295 if ( $obj->extra['conditional'] ?? false ) { 296 return false; 297 } 295 298 296 299 if ( null === $obj->ver ) { … … 304 307 } 305 308 306 $src = $obj->src; 307 $strategy = $this->get_eligible_loading_strategy( $handle ); 308 $intended_strategy = (string) $this->get_data( $handle, 'strategy' ); 309 $ie_conditional_prefix = ''; 310 $ie_conditional_suffix = ''; 311 $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : ''; 309 $src = $obj->src; 310 $strategy = $this->get_eligible_loading_strategy( $handle ); 311 $intended_strategy = (string) $this->get_data( $handle, 'strategy' ); 312 312 313 313 if ( ! $this->is_delayed_strategy( $intended_strategy ) ) { … … 334 334 } 335 335 336 if ( $conditional ) {337 $ie_conditional_prefix = "<!--[if {$conditional}]>\n";338 $ie_conditional_suffix = "<![endif]-->\n";339 }340 341 336 $before_script = $this->get_inline_script_tag( $handle, 'before' ); 342 337 $after_script = $this->get_inline_script_tag( $handle, 'after' ); 343 338 344 339 if ( $before_script || $after_script ) { 345 $inline_script_tag = $ ie_conditional_prefix . $before_script . $after_script . $ie_conditional_suffix;340 $inline_script_tag = $before_script . $after_script; 346 341 } else { 347 342 $inline_script_tag = ''; … … 379 374 _print_scripts(); 380 375 $this->reset(); 381 } elseif ( $this->in_default_dir( $filtered_src ) && ! $conditional) {376 } elseif ( $this->in_default_dir( $filtered_src ) ) { 382 377 $this->print_code .= $this->print_extra_script( $handle, false ); 383 378 $this->concat .= "$handle,"; … … 390 385 } 391 386 392 $has_conditional_data = $conditional && $this->get_data( $handle, 'data' );393 394 if ( $has_conditional_data ) {395 echo $ie_conditional_prefix;396 }397 398 387 $this->print_extra_script( $handle ); 399 400 if ( $has_conditional_data ) {401 echo $ie_conditional_suffix;402 }403 388 404 389 // A single item may alias a set of items, by having dependencies, but no source. … … 454 439 $attr['fetchpriority'] = $actual_fetchpriority; 455 440 } 441 456 442 if ( $original_fetchpriority !== $actual_fetchpriority ) { 457 443 $attr['data-wp-fetchpriority'] = $original_fetchpriority; 458 444 } 459 445 460 $tag = $translations . $ ie_conditional_prefix . $before_script;446 $tag = $translations . $before_script; 461 447 $tag .= wp_get_script_tag( $attr ); 462 $tag .= $after_script . $ie_conditional_suffix;448 $tag .= $after_script; 463 449 464 450 /** … … 850 836 if ( ! isset( $this->registered[ $handle ] ) ) { 851 837 return false; 838 } 839 840 if ( 'conditional' === $key ) { 841 // If a dependency is declared by a conditional script, remove it. 842 $this->registered[ $handle ]->deps = array(); 852 843 } 853 844 -
trunk/src/wp-includes/class-wp-styles.php
r60920 r60948 155 155 156 156 $obj = $this->registered[ $handle ]; 157 157 if ( $obj->extra['conditional'] ?? false ) { 158 159 return false; 160 } 158 161 if ( null === $obj->ver ) { 159 162 $ver = ''; … … 166 169 } 167 170 168 $src = $obj->src; 169 $ie_conditional_prefix = ''; 170 $ie_conditional_suffix = ''; 171 $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : ''; 172 173 if ( $conditional ) { 174 $ie_conditional_prefix = "<!--[if {$conditional}]>\n"; 175 $ie_conditional_suffix = "<![endif]-->\n"; 176 } 177 171 $src = $obj->src; 178 172 $inline_style = $this->print_inline_style( $handle, false ); 179 173 … … 190 184 191 185 if ( $this->do_concat ) { 192 if ( $this->in_default_dir( $src ) && ! $conditional && !isset( $obj->extra['alt'] ) ) {186 if ( $this->in_default_dir( $src ) && ! isset( $obj->extra['alt'] ) ) { 193 187 $this->concat .= "$handle,"; 194 188 $this->concat_version .= "$handle$ver"; … … 280 274 281 275 if ( $this->do_concat ) { 282 $this->print_html .= $ie_conditional_prefix;283 276 $this->print_html .= $tag; 284 277 if ( $inline_style_tag ) { 285 278 $this->print_html .= $inline_style_tag; 286 279 } 287 $this->print_html .= $ie_conditional_suffix;288 280 } else { 289 echo $ie_conditional_prefix;290 281 echo $tag; 291 282 $this->print_inline_style( $handle ); 292 echo $ie_conditional_suffix;293 283 } 294 284 … … 372 362 373 363 return true; 364 } 365 366 /** 367 * Overrides the add_data method from WP_Dependencies, to allow unsetting dependencies for conditional styles. 368 * 369 * @since 6.9.0 370 * 371 * @param string $handle Name of the item. Should be unique. 372 * @param string $key The data key. 373 * @param mixed $value The data value. 374 * @return bool True on success, false on failure. 375 */ 376 public function add_data( $handle, $key, $value ) { 377 if ( ! isset( $this->registered[ $handle ] ) ) { 378 return false; 379 } 380 381 if ( 'conditional' === $key ) { 382 $this->registered[ $handle ]->deps = array(); 383 } 384 385 return parent::add_data( $handle, $key, $value ); 374 386 } 375 387 -
trunk/src/wp-includes/css/wp-embed-template-ie.css
r46586 r60948 1 .dashicons-no { 2 background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAQAAAAngNWGAAAAcElEQVR4AdXRVxmEMBAGwJMQCUhAIhKQECmRsFJwMFfp7HfP/E8pk0173CuKpt/0R+WaBaaZqogLagBMuh+DdoKbyRCwqZ/SnM0R5oQuZ2UHS8Z6k23qPxZCTrV5UlHMi8bsfHVXP7K/GXZHaTO7S54CWLdHlN2YIwAAAABJRU5ErkJggg==); 3 } 4 5 .dashicons-admin-comments { 6 background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAATUlEQVR4AWMYWqCpvUcAiA8A8X9iMFStAD4DG0AKScQNVDZw1MBRAwvIMLCA5jmFlCD4AMQGlOTtBgoNwzQQ3TCKDaTcMMxYN2AYVgAAYPKsEBxN0PIAAAAASUVORK5CYII=); 7 } 8 9 .wp-embed-comments a:hover .dashicons-admin-comments { 10 background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAATElEQVR4AWMYYqB4lQAQHwDi/8RgqFoBfAY2gBSSiBuobOCogaMGFpBhYAEdcwrhIPgAxAaU5O0GCg3DNBDdMIoNpNwwzFg3YBhWAABG71qAFYcFqgAAAABJRU5ErkJggg==); 11 } 12 13 .dashicons-share { 14 background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAc0lEQVR4AWMYfqCpvccAiBcA8X8gfgDEBZQaeAFkGBoOoMR1/7HgDeQa2ECZgQiDHID4AMwAor0MCmBoQP+HBnwAskFQdgBRkQJViGk7wiAHUr21AYdhDTA1dDOQHl6mPFLokmwoT9j0z3qUFw70L77oDwAiuzCIub1XpQAAAABJRU5ErkJggg==); 15 } 16 17 .wp-embed-share-dialog-open:hover .dashicons-share { 18 background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAc0lEQVR4AWMYhqB4lQEQLwDi/0D8AIgLKDXwAsgwNBxAiev+Y8EbyDWwgTIDEQY5APEBmAFEexkUwNCA/g8N+ABkg6DsAKIiBaoQ03aEQQ6kemsDDsMaYEroZiA9vEx5pNAl2VCesOmf9SgvHOhffNEfAAAMqPR5IEZH5wAAAABJRU5ErkJggg==); 19 } 1 /* Deprecated in WordPress 6.9 */ -
trunk/src/wp-includes/embed.php
r60913 r60948 1057 1057 */ 1058 1058 function enqueue_embed_scripts() { 1059 wp_enqueue_style( 'wp-embed-template-ie' );1060 1059 1061 1060 /** -
trunk/src/wp-includes/functions.wp-scripts.php
r60704 r60948 436 436 * 437 437 * Possible values for $key and $value: 438 * ' conditional' string Comments for IE 6, lte IE 7, etc.438 * 'strategy' string 'defer' or 'async'. 439 439 * 440 440 * @since 4.2.0 441 * @since 6.9.0 Updated possible values to remove reference to 'conditional' and add 'strategy'. 441 442 * 442 443 * @see WP_Dependencies::add_data() -
trunk/src/wp-includes/functions.wp-styles.php
r58200 r60948 221 221 * 222 222 * Possible values for $key and $value: 223 * 'conditional' string Comments for IE 6, lte IE 7 etc.224 223 * 'rtl' bool|string To declare an RTL stylesheet. 225 224 * 'suffix' string Optional suffix, used in combination with RTL. … … 234 233 * @since 5.8.0 Added 'path' as an official value for $key. 235 234 * See {@see wp_maybe_inline_styles()}. 235 * @since 6.9.0 'conditional' value changed. If the 'conditional' parameter is present 236 * the stylesheet will be ignored. 236 237 * 237 238 * @param string $handle Name of the stylesheet. 238 239 * @param string $key Name of data point for which we're storing a value. 239 * Accepts ' conditional', 'rtl' and 'suffix', 'alt', 'title' and 'path'.240 * Accepts 'rtl' and 'suffix', 'alt', 'title' and 'path'. 240 241 * @param mixed $value String containing the CSS data to be added. 241 242 * @return bool True on success, false on failure. -
trunk/src/wp-includes/script-loader.php
r60920 r60948 1044 1044 did_action( 'init' ) && $scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n ); 1045 1045 1046 $scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array( 'plupload', 'jquery', ' json2', 'media-models' ), false, 1 );1046 $scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array( 'plupload', 'jquery', 'media-models' ), false, 1 ); 1047 1047 did_action( 'init' ) && $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n ); 1048 1048 … … 1053 1053 } 1054 1054 1055 // Not used in core, obsolete. Registered for backward compatibility. 1055 1056 $scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", array(), '2015-05-03' ); 1056 did_action( 'init' ) && $scripts->add_data( 'json2', 'conditional', ' lt IE 8' );1057 did_action( 'init' ) && $scripts->add_data( 'json2', 'conditional', '_required-conditional-dependency_' ); 1057 1058 1058 1059 $scripts->add( 'underscore', "/wp-includes/js/underscore$dev_suffix.js", array(), '1.13.7', 1 ); … … 1285 1286 $scripts->add( 'hoverintent-js', '/wp-includes/js/hoverintent-js.min.js', array(), '2.2.1', 1 ); 1286 1287 1287 $scripts->add( 'customize-base', "/wp-includes/js/customize-base$suffix.js", array( 'jquery', ' json2', 'underscore' ), false, 1 );1288 $scripts->add( 'customize-base', "/wp-includes/js/customize-base$suffix.js", array( 'jquery', 'underscore' ), false, 1 ); 1288 1289 $scripts->add( 'customize-loader', "/wp-includes/js/customize-loader$suffix.js", array( 'customize-base' ), false, 1 ); 1289 1290 $scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'wp-a11y', 'customize-base' ), false, 1 ); … … 1505 1506 $scripts->set_translations( 'media' ); 1506 1507 1507 $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array( 'jquery', 'jquery-ui-core', ' json2', 'imgareaselect', 'wp-a11y' ), false, 1 );1508 $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array( 'jquery', 'jquery-ui-core', 'imgareaselect', 'wp-a11y' ), false, 1 ); 1508 1509 $scripts->set_translations( 'image-edit' ); 1509 1510 … … 1515 1516 * see https://core.trac.wordpress.org/ticket/42321 1516 1517 */ 1517 $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox', ' json2', 'underscore' ) );1518 $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox', 'underscore' ) ); 1518 1519 $scripts->set_translations( 'nav-menu' ); 1519 1520 … … 1647 1648 $styles->add( 'wp-pointer', "/wp-includes/css/wp-pointer$suffix.css", array( 'dashicons' ) ); 1648 1649 $styles->add( 'customize-preview', "/wp-includes/css/customize-preview$suffix.css", array( 'dashicons' ) ); 1649 $styles->add( 'wp-embed-template-ie', "/wp-includes/css/wp-embed-template-ie$suffix.css" );1650 1650 $styles->add( 'wp-empty-template-alert', "/wp-includes/css/wp-empty-template-alert$suffix.css" ); 1651 $styles->add_data( 'wp-embed-template-ie', 'conditional', 'lte IE 8' );1652 1651 1653 1652 // External libraries and friends. … … 1665 1664 $styles->add( 'colors-fresh', false, array( 'wp-admin', 'buttons' ) ); // Old handle. 1666 1665 $styles->add( 'open-sans', $open_sans_font_url ); // No longer used in core as of 4.6. 1666 $styles->add( 'wp-embed-template-ie', false ); 1667 $styles->add_data( 'wp-embed-template-ie', 'conditional', '_required-conditional-dependency_' ); 1667 1668 1668 1669 // Noto Serif is no longer used by core, but may be relied upon by themes and plugins. -
trunk/tests/phpunit/tests/dependencies/scripts.php
r60931 r60948 1960 1960 * Testing `wp_script_add_data` with the conditional key. 1961 1961 * 1962 * @expectedDeprecated WP_Dependencies->add_data() 1963 * 1964 * @since 6.9.0 Conditional comments should now return an empty string. 1965 * 1962 1966 * @ticket 16024 1963 1967 */ … … 1966 1970 wp_enqueue_script( 'test-only-conditional', 'example.com', array(), null ); 1967 1971 wp_script_add_data( 'test-only-conditional', 'conditional', 'gt IE 7' ); 1968 $expected = "<!--[if gt IE 7]>\n<script type=\"text/javascript\" src=\"http://example.com\" id=\"test-only-conditional-js\"></script>\n<![endif]-->\n";1969 1970 // Go!1971 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );1972 1973 // No scripts left to print.1974 $this->assertSame( '', get_echo( 'wp_print_scripts' ) );1975 }1976 1977 /**1978 * Testing `wp_script_add_data` with both the data & conditional keys.1979 *1980 * @ticket 160241981 */1982 public function test_wp_script_add_data_with_data_and_conditional_keys() {1983 // Enqueue and add data plus conditional comments for both.1984 wp_enqueue_script( 'test-conditional-with-data', 'example.com', array(), null );1985 wp_script_add_data( 'test-conditional-with-data', 'data', 'testing' );1986 wp_script_add_data( 'test-conditional-with-data', 'conditional', 'lt IE 9' );1987 $expected = "<!--[if lt IE 9]>\n<script type='text/javascript' id='test-conditional-with-data-js-extra'>\n/* <![CDATA[ */\ntesting\n//# sourceURL=test-conditional-with-data-js-extra\n/* ]]> */\n</script>\n<![endif]-->\n";1988 $expected .= "<!--[if lt IE 9]>\n<script type='text/javascript' src='http://example.com' id='test-conditional-with-data-js'></script>\n<![endif]-->\n";1989 $expected = str_replace( "'", '"', $expected );1990 1991 // Go!1992 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );1993 1994 1972 // No scripts left to print. 1995 1973 $this->assertSame( '', get_echo( 'wp_print_scripts' ) ); … … 2404 2382 2405 2383 /** 2384 * @expectedDeprecated WP_Dependencies->add_data() 2385 * 2406 2386 * @ticket 14853 2387 * @ticket 63821 2407 2388 */ 2408 2389 public function test_wp_add_inline_script_after_and_before_with_concat_and_conditional() { … … 2412 2393 $wp_scripts->default_dirs = array( '/wp-admin/js/', '/wp-includes/js/' ); // Default dirs as in wp-includes/script-loader.php. 2413 2394 2414 $expected_localized = "<!--[if gte IE 9]>\n"; 2415 $expected_localized .= "<script type='text/javascript' id='test-example-js-extra'>\n/* <![CDATA[ */\nvar testExample = {\"foo\":\"bar\"};\n/* ]]> */\n</script>\n"; 2416 $expected_localized .= "<![endif]-->\n"; 2417 $expected_localized = str_replace( "'", '"', $expected_localized ); 2418 2419 $expected = "<!--[if gte IE 9]>\n"; 2420 $expected .= "<script type='text/javascript' id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n//# sourceURL=test-example-js-before\n/* ]]> */\n</script>\n"; 2421 $expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n"; 2422 $expected .= "<script type='text/javascript' id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n//# sourceURL=test-example-js-after\n/* ]]> */\n</script>\n"; 2423 $expected .= "<![endif]-->\n"; 2424 $expected = str_replace( "'", '"', $expected ); 2395 // Conditional scripts should not output. 2396 $expected_localized = ''; 2397 $expected = ''; 2425 2398 2426 2399 wp_enqueue_script( 'test-example', 'example.com', array(), null ); … … 2460 2433 2461 2434 /** 2435 * @expectedDeprecated WP_Dependencies->add_data() 2436 * 2462 2437 * @ticket 36392 2438 * @ticket 63821 2463 2439 */ 2464 2440 public function test_wp_add_inline_script_after_with_concat_and_conditional_and_core_dependency() { 2465 global $wp_scripts, $wp_version; 2466 2441 global $wp_scripts; 2467 2442 wp_default_scripts( $wp_scripts ); 2468 2443 2469 2444 $wp_scripts->base_url = ''; 2470 2445 $wp_scripts->do_concat = true; 2471 2472 $expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver={$wp_version}'></script>\n"; 2473 $expected .= "<!--[if gte IE 9]>\n"; 2474 $expected .= "<script type=\"text/javascript\" src=\"http://example.com\" id=\"test-example-js\"></script>\n"; 2475 $expected .= "<script type=\"text/javascript\" id=\"test-example-js-after\">\n/* <![CDATA[ */\nconsole.log(\"after\");\n//# sourceURL=test-example-js-after\n/* ]]> */\n</script>\n"; 2476 $expected .= "<![endif]-->\n"; 2446 $expected = ''; 2477 2447 2478 2448 wp_enqueue_script( 'test-example', 'http://example.com', array( 'jquery' ), null ); -
trunk/tests/phpunit/tests/dependencies/styles.php
r60920 r60948 328 328 * Test to make sure that inline styles attached to conditional 329 329 * stylesheets are also conditional. 330 * 331 * @expectedDeprecated WP_Dependencies->add_data() 330 332 */ 331 333 public function test_conditional_inline_styles_are_also_conditional() { 332 $expected = <<<CSS 333 <!--[if IE]> 334 <link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' type='text/css' media='all' /> 335 <style id='handle-inline-css' type='text/css'> 336 a { color: blue; } 337 /*# sourceURL=handle-inline-css */ 338 </style> 339 <![endif]--> 340 341 CSS; 334 $expected = ''; 342 335 wp_enqueue_style( 'handle', 'http://example.com', array(), 1 ); 343 336 wp_style_add_data( 'handle', 'conditional', 'IE' );
Note: See TracChangeset
for help on using the changeset viewer.