--- a/wp/wp-includes/js/shortcode.js Tue Jun 09 11:14:17 2015 +0000
+++ b/wp/wp-includes/js/shortcode.js Mon Oct 14 17:39:30 2019 +0200
@@ -1,6 +1,10 @@
// Utility functions for parsing and handling shortcodes in JavaScript.
-// Ensure the global `wp` object exists.
+/**
+ * Ensure the global `wp` object exists.
+ *
+ * @namespace wp
+ */
window.wp = window.wp || {};
(function(){
@@ -134,8 +138,9 @@
// 5. An attribute name, that corresponds to...
// 6. an unquoted value.
// 7. A numeric attribute in double quotes.
- // 8. An unquoted numeric attribute.
- pattern = /(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/g;
+ // 8. A numeric attribute in single quotes.
+ // 9. An unquoted numeric attribute.
+ pattern = /([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*'([^']*)'(?:\s|$)|([\w-]+)\s*=\s*([^\s'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|'([^']*)'(?:\s|$)|(\S+)(?:\s|$)/g;
// Map zero-width spaces to actual spaces.
text = text.replace( /[\u00a0\u200b]/g, ' ' );
@@ -152,6 +157,8 @@
numeric.push( match[7] );
} else if ( match[8] ) {
numeric.push( match[8] );
+ } else if ( match[9] ) {
+ numeric.push( match[9] );
}
}
@@ -326,11 +333,6 @@
_.each( options.attrs, function( value, attr ) {
text += ' ' + attr;
- // Use empty attribute notation where possible.
- if ( '' === value ) {
- return;
- }
-
// Convert boolean values to strings.
if ( _.isBoolean( value ) ) {
value = value ? 'true' : 'false';