Paladox has uploaded a new change for review. https://gerrit.wikimedia.org/r/181134
Change subject: Upgrade jQuery to 1.11.2 ...................................................................... Upgrade jQuery to 1.11.2 Where i got code from * http://code.jquery.com/jquery-1.11.2.js Release notes * http://blog.jquery.com/2014/12/18/jquery-1-11-2-and-2-1-3-released-safari-fail-safe-edition/ Change-Id: Ic972e272be9deea6b44b2375fa31ac128e452dac --- M resources/lib/jquery/jquery.js M tests/parser/parserTests.txt 2 files changed, 457 insertions(+), 224 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/34/181134/1 diff --git a/resources/lib/jquery/jquery.js b/resources/lib/jquery/jquery.js index d4b67f7..1c3aa82 100644 --- a/resources/lib/jquery/jquery.js +++ b/resources/lib/jquery/jquery.js @@ -1,5 +1,5 @@ /*! - * jQuery JavaScript Library v1.11.1 + * jQuery JavaScript Library v1.11.2 * http://jquery.com/ * * Includes Sizzle.js @@ -9,7 +9,7 @@ * Released under the MIT license * http://jquery.org/license * - * Date: 2014-05-01T17:42Z + * Date: 2014-12-17T15:27Z */ (function( global, factory ) { @@ -64,7 +64,7 @@ var - version = "1.11.1", + version = "1.11.2", // Define a local copy of jQuery jQuery = function( selector, context ) { @@ -269,7 +269,8 @@ // parseFloat NaNs numeric-cast false positives (null|true|false|"") // ...but misinterprets leading-number strings, particularly hex literals ("0x...") // subtraction forces infinities to NaN - return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0; + // adding 1 corrects loss of precision from parseFloat (#15100) + return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0; }, isEmptyObject: function( obj ) { @@ -584,14 +585,14 @@ } var Sizzle = /*! - * Sizzle CSS Selector Engine v1.10.19 + * Sizzle CSS Selector Engine v2.2.0-pre * http://sizzlejs.com/ * - * Copyright 2013 jQuery Foundation, Inc. and other contributors + * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * - * Date: 2014-04-18 + * Date: 2014-12-16 */ (function( window ) { @@ -618,7 +619,7 @@ contains, // Instance-specific data - expando = "sizzle" + -(new Date()), + expando = "sizzle" + 1 * new Date(), preferredDoc = window.document, dirruns = 0, done = 0, @@ -633,7 +634,6 @@ }, // General-purpose constants - strundefined = typeof undefined, MAX_NEGATIVE = 1 << 31, // Instance methods @@ -643,12 +643,13 @@ push_native = arr.push, push = arr.push, slice = arr.slice, - // Use a stripped-down indexOf if we can't use a native one - indexOf = arr.indexOf || function( elem ) { + // Use a stripped-down indexOf as it's faster than native + // http://jsperf.com/thor-indexof-vs-for/5 + indexOf = function( list, elem ) { var i = 0, - len = this.length; + len = list.length; for ( ; i < len; i++ ) { - if ( this[i] === elem ) { + if ( list[i] === elem ) { return i; } } @@ -688,6 +689,7 @@ ")\\)|)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rwhitespace = new RegExp( whitespace + "+", "g" ), rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), @@ -739,6 +741,14 @@ String.fromCharCode( high + 0x10000 ) : // Supplemental Plane codepoint (surrogate pair) String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }, + + // Used for iframes + // See setDocument() + // Removing the function wrapper causes a "Permission Denied" + // error in IE + unloadHandler = function() { + setDocument(); }; // Optimize for push.apply( _, NodeList ) @@ -781,19 +791,18 @@ context = context || document; results = results || []; + nodeType = context.nodeType; - if ( !selector || typeof selector !== "string" ) { + if ( typeof selector !== "string" || !selector || + nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { + return results; } - if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { - return []; - } + if ( !seed && documentIsHTML ) { - if ( documentIsHTML && !seed ) { - - // Shortcuts - if ( (match = rquickExpr.exec( selector )) ) { + // Try to shortcut find operations when possible (e.g., not under DocumentFragment) + if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { // Speed-up: Sizzle("#ID") if ( (m = match[1]) ) { if ( nodeType === 9 ) { @@ -825,7 +834,7 @@ return results; // Speed-up: Sizzle(".CLASS") - } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { + } else if ( (m = match[3]) && support.getElementsByClassName ) { push.apply( results, context.getElementsByClassName( m ) ); return results; } @@ -835,7 +844,7 @@ if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { nid = old = expando; newContext = context; - newSelector = nodeType === 9 && selector; + newSelector = nodeType !== 1 && selector; // qSA works strangely on Element-rooted queries // We can work around this by specifying an extra ID on the root @@ -1022,7 +1031,7 @@ * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value */ function testContext( context ) { - return context && typeof context.getElementsByTagName !== strundefined && context; + return context && typeof context.getElementsByTagName !== "undefined" && context; } // Expose support vars for convenience @@ -1046,9 +1055,8 @@ * @returns {Object} Returns the current document */ setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, - doc = node ? node.ownerDocument || node : preferredDoc, - parent = doc.defaultView; + var hasCompare, parent, + doc = node ? node.ownerDocument || node : preferredDoc; // If no document and documentElement is available, return if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { @@ -1058,9 +1066,7 @@ // Set our document document = doc; docElem = doc.documentElement; - - // Support tests - documentIsHTML = !isXML( doc ); + parent = doc.defaultView; // Support: IE>8 // If iframe document is assigned to "document" variable and if iframe has been reloaded, @@ -1069,21 +1075,22 @@ if ( parent && parent !== parent.top ) { // IE11 does not have attachEvent, so all must suffer if ( parent.addEventListener ) { - parent.addEventListener( "unload", function() { - setDocument(); - }, false ); + parent.addEventListener( "unload", unloadHandler, false ); } else if ( parent.attachEvent ) { - parent.attachEvent( "onunload", function() { - setDocument(); - }); + parent.attachEvent( "onunload", unloadHandler ); } } + + /* Support tests + ---------------------------------------------------------------------- */ + documentIsHTML = !isXML( doc ); /* Attributes ---------------------------------------------------------------------- */ // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) + // Verify that getAttribute really returns attributes and not properties + // (excepting IE8 booleans) support.attributes = assert(function( div ) { div.className = "i"; return !div.getAttribute("className"); @@ -1098,17 +1105,8 @@ return !div.getElementsByTagName("*").length; }); - // Check if getElementsByClassName can be trusted - support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) { - div.innerHTML = "<div class='a'></div><div class='a i'></div>"; - - // Support: Safari<4 - // Catch class over-caching - div.firstChild.className = "i"; - // Support: Opera<10 - // Catch gEBCN failure to find non-leading classes - return div.getElementsByClassName("i").length === 2; - }); + // Support: IE<9 + support.getElementsByClassName = rnative.test( doc.getElementsByClassName ); // Support: IE<10 // Check if getElementById returns elements by name @@ -1122,7 +1120,7 @@ // ID find and filter if ( support.getById ) { Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && documentIsHTML ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { var m = context.getElementById( id ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 @@ -1143,7 +1141,7 @@ Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { - var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); return node && node.value === attrId; }; }; @@ -1152,14 +1150,20 @@ // Tag Expr.find["TAG"] = support.getElementsByTagName ? function( tag, context ) { - if ( typeof context.getElementsByTagName !== strundefined ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { return context.getElementsByTagName( tag ); + + // DocumentFragment nodes don't have gEBTN + } else if ( support.qsa ) { + return context.querySelectorAll( tag ); } } : + function( tag, context ) { var elem, tmp = [], i = 0, + // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too results = context.getElementsByTagName( tag ); // Filter out possible comments @@ -1177,7 +1181,7 @@ // Class Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { + if ( documentIsHTML ) { return context.getElementsByClassName( className ); } }; @@ -1206,13 +1210,15 @@ // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 - div.innerHTML = "<select msallowclip=''><option selected=''></option></select>"; + docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" + + "<select id='" + expando + "-\f]' msallowcapture=''>" + + "<option selected=''></option></select>"; // Support: IE8, Opera 11-12.16 // Nothing should be selected when empty strings follow ^= or $= or *= // The test attribute must be unknown in Opera but "safe" for WinRT // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section - if ( div.querySelectorAll("[msallowclip^='']").length ) { + if ( div.querySelectorAll("[msallowcapture^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); } @@ -1222,11 +1228,23 @@ rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); } + // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+ + if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { + rbuggyQSA.push("~="); + } + // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); + } + + // Support: Safari 8+, iOS 8+ + // https://bugs.webkit.org/show_bug.cgi?id=136851 + // In-page `selector#id sibing-combinator selector` fails + if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { + rbuggyQSA.push(".#.+[+~]"); } }); @@ -1344,7 +1362,7 @@ // Maintain original order return sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 0; } @@ -1371,7 +1389,7 @@ aup ? -1 : bup ? 1 : sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 0; // If the nodes are siblings, we can do a quick check @@ -1434,7 +1452,7 @@ elem.document && elem.document.nodeType !== 11 ) { return ret; } - } catch(e) {} + } catch (e) {} } return Sizzle( expr, document, null, [ elem ] ).length > 0; @@ -1653,7 +1671,7 @@ return pattern || (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && classCache( className, function( elem ) { - return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); + return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); }); }, @@ -1675,7 +1693,7 @@ operator === "^=" ? check && result.indexOf( check ) === 0 : operator === "*=" ? check && result.indexOf( check ) > -1 : operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : false; }; @@ -1795,7 +1813,7 @@ matched = fn( seed, argument ), i = matched.length; while ( i-- ) { - idx = indexOf.call( seed, matched[i] ); + idx = indexOf( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : @@ -1834,6 +1852,8 @@ function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); + // Don't keep the element (issue #299) + input[0] = null; return !results.pop(); }; }), @@ -1845,6 +1865,7 @@ }), "contains": markFunction(function( text ) { + text = text.replace( runescape, funescape ); return function( elem ) { return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; }; @@ -2266,7 +2287,7 @@ i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { + (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } @@ -2301,13 +2322,16 @@ return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; + return indexOf( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); + // Avoid hanging onto element (issue #299) + checkContext = null; + return ret; } ]; for ( ; i < len; i++ ) { @@ -2557,7 +2581,7 @@ // Sort stability support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; -// Support: Chrome<14 +// Support: Chrome 14-35+ // Always assume duplicates if they aren't passed to the comparison function support.detectDuplicates = !!hasDuplicate; @@ -6115,7 +6139,14 @@ if ( window.getComputedStyle ) { getStyles = function( elem ) { - return elem.ownerDocument.defaultView.getComputedStyle( elem, null ); + // Support: IE<=11+, Firefox<=30+ (#15098, #14150) + // IE throws on elements created in popups + // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" + if ( elem.ownerDocument.defaultView.opener ) { + return elem.ownerDocument.defaultView.getComputedStyle( elem, null ); + } + + return window.getComputedStyle( elem, null ); }; curCSS = function( elem, name, computed ) { @@ -6363,6 +6394,8 @@ reliableMarginRightVal = !parseFloat( ( window.getComputedStyle( contents, null ) || {} ).marginRight ); + + div.removeChild( contents ); } // Support: IE8 @@ -9070,7 +9103,8 @@ } // We can fire global events as of now if asked to - fireGlobals = s.global; + // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) + fireGlobals = jQuery.event && s.global; // Watch for a new set of requests if ( fireGlobals && jQuery.active++ === 0 ) { @@ -9329,13 +9363,6 @@ }; }); -// Attach a bunch of functions for handling common AJAX events -jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { - jQuery.fn[ type ] = function( fn ) { - return this.on( type, fn ); - }; -}); - jQuery._evalUrl = function( url ) { return jQuery.ajax({ @@ -9561,8 +9588,9 @@ // Support: IE<10 // Open requests must be manually aborted on unload (#5280) -if ( window.ActiveXObject ) { - jQuery( window ).on( "unload", function() { +// See https://support.microsoft.com/kb/2856746 for more info +if ( window.attachEvent ) { + window.attachEvent( "onunload", function() { for ( var key in xhrCallbacks ) { xhrCallbacks[ key ]( undefined, true ); } @@ -9996,6 +10024,16 @@ +// Attach a bunch of functions for handling common AJAX events +jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { + jQuery.fn[ type ] = function( fn ) { + return this.on( type, fn ); + }; +}); + + + + jQuery.expr.filters.animated = function( elem ) { return jQuery.grep(jQuery.timers, function( fn ) { return elem === fn.elem; diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 63f6a75..f7dc0a9 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -540,24 +540,12 @@ !! test Italics and bold: 2-quote opening sequence: (2,3) -!! options -parsoid=wt2html !! wikitext ''foo''' !! html/* <p><i>foo'</i> </p> !!end - -# same html as previous, but wikitext adjusted to match parsoid html2wt -!! test -Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki -!! wikitext -''foo'<nowiki/>'' -!! html -<p><i>foo'</i> -</p> -!! end !! test Italics and bold: 2-quote opening sequence: (2,4) @@ -615,21 +603,9 @@ !! test Italics and bold: 3-quote opening sequence: (3,2) -!! options -parsoid=wt2html !! wikitext '''foo'' !! html/* -<p>'<i>foo</i> -</p> -!!end - -# same html as previous, but wikitext adjusted to match parsoid html2wt -!! test -Italics and bold: 3-quote opening sequence: (3,2) w/ nowiki -!! wikitext -'<nowiki/>''foo'' -!! html <p>'<i>foo</i> </p> !!end @@ -645,24 +621,12 @@ !! test Italics and bold: 3-quote opening sequence: (3,4) -!! options -parsoid=wt2html !! wikitext '''foo'''' !! html/* <p><b>foo'</b> </p> !!end - -# same html as previous, but wikitext adjusted to match parsoid html2wt -!! test -Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki -!! wikitext -'''foo'<nowiki/>''' -!! html -<p><b>foo'</b> -</p> -!! end # The PHP parser strips the empty tags out for giggles; parsoid doesn't. !! test @@ -720,21 +684,9 @@ !! test Italics and bold: 4-quote opening sequence: (4,3) -!! options -parsoid=wt2html !! wikitext ''''foo''' !! html/* -<p>'<b>foo</b> -</p> -!!end - -# same html as previous, but wikitext adjusted to match parsoid html2wt -!! test -Italics and bold: 4-quote opening sequence: (4,3) w/ nowiki -!! wikitext -'<nowiki/>'''foo''' -!! html <p>'<b>foo</b> </p> !!end @@ -849,16 +801,6 @@ </p> !!end -# same html as previous, but wikitext adjusted to match parsoid html2wt -!! test -Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki -!! wikitext -'''''foo'<nowiki/>''''' -!! html -<p><i><b>foo'</b></i> -</p> -!! end - !! test Italics and bold: 5-quote opening sequence: (5,5) !! wikitext @@ -867,6 +809,15 @@ <p><i><b>foo</b></i> </p> !!end + +!! test +Italics and bold: 5-quote opening sequence: (5,6) +!! wikitext +'''''foo'''''' +!! html/* +<p><i><b>foo'</b></i> +</p> +!! end ### ### multiple quote sequences in a line @@ -1047,22 +998,9 @@ !! test Italics and bold: other quote tests: (3,2,3,3) -!! options -parsoid=wt2html !! wikitext '''this is about ''foo'''s family''' !! html/* -<p>'<i>this is about </i>foo<b>s family</b> -</p> -!!end - - -# same html as previous, but wikitext adjusted to match parsoid html2wt -!! test -Italics and bold: other quote tests: (3,2,3,3) w/ nowiki -!! wikitext -'<nowiki/>''this is about ''foo'''s family''' -!! html <p>'<i>this is about </i>foo<b>s family</b> </p> !!end @@ -1082,9 +1020,11 @@ Italicized possessive !! wikitext The ''[[Main Page]]'''s talk page. -!! html +!! html/php <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page. </p> +!! html/parsoid +<p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p> !! end !! test @@ -3965,6 +3905,76 @@ </ol></li> </ul> !! end + +!! test +Definition Lists: colons occurring in tags +!! wikitext +;a:b +;'''a:b''' +;<i>a:b</i> +;<span>a:b</span> +;<div>a:b</div> +;{{echo|a:b}} +;{{echo|''a:b''}} +!! html +<dl><dt>a</dt> +<dd>b</dd> +<dt><b>a:b</b></dt> +<dt><i>a:b</i></dt> +<dt><span>a:b</span></dt> +<dt><div>a:b</div></dt> +<dt>a</dt> +<dd>b</dd> +<dt><i>a:b</i></dt></dl> + +!! end + +!! test +Definition Lists: colons and tables 1 +!! wikitext +:{| +| x +|} +:{| +| y +|} +!! html +<dl><dd><table> +<tr> +<td> x +</td></tr></table></dd></dl> +<dl><dd><table> +<tr> +<td> y +</td></tr></table></dd></dl> + +!! end + +# Parsoid's output (as documented below) differs from php's in this case. +# This is probably a bug. If we fixup parsoid to match php's output, the +# above test should pass and the below test case can be removed. It is +# unclear which output is more desirable. + +!! test +Definition Lists: colons and tables 2 +!! wikitext +:{| +| x +|} +:{| +| y +|} +!! html/parsoid +<dl><dd><table> +<tr> +<td> x +</td></tr></table></dd> +<dd><table> +<tr> +<td> y +</td></tr></table></dd></dl> +!! end + ### ### External links @@ -20004,17 +20014,15 @@ !! test Headings: 3. Nested inside html with wikitext split by html tags !! options -parsoid=html2wt +parsoid=html2wt,wt2wt !! wikitext = ='''bold'''<nowiki>foo=</nowiki> = -!! html -<h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1> +!! html/parsoid +<h1>=<b>bold</b>foo=</h1> !!end !! test Headings: 4a. No escaping needed (testing just h1 and h2) -!! options -parsoid=html2wt !! wikitext = =foo = @@ -20028,19 +20036,27 @@ == foo= == -= ''=''foo= = - -= <nowiki>=</nowiki> = -!! html += = = +!! html/parsoid <h1>=foo</h1> <h1>foo=</h1> <h1> =foo= </h1> <h1>=foo= bar</h1> <h2>=foo</h2> <h2>foo=</h2> -<h1><i>=</i>foo=</h1> -<h1><span typeof="mw:Nowiki">=</span></h1> +<h1>=</h1> !!end + +!! test +Headings: 4a'. No escaping needed (Parsoid bug T84903) +!! wikitext += ''=''foo= = +!! html/php +<h1><span class="mw-headline" id=".3Dfoo.3D"><i>=</i>foo=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: =foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1> + +!! html/parsoid +<h1><i>=</i>foo=</h1> +!! end !! test Headings: 4b. No escaping needed (inside p-tags) @@ -20288,33 +20304,36 @@ !! wikitext * bar <span><nowiki>[[foo]]</nowiki></span> -*=bar <span><nowiki>[[foo]]</nowiki></span> +* =bar <span><nowiki>[[foo]]</nowiki></span> -*[[bar <span><nowiki>[[foo]]</nowiki></span> +* [[bar <span><nowiki>[[foo]]</nowiki></span> -*]]bar <span><nowiki>[[foo]]</nowiki></span> +* ]]bar <span><nowiki>[[foo]]</nowiki></span> -*=bar <span>foo]]</span>= +* =bar <span>foo]]</span>= * <s></s>: a + +* ''* foo'' !! html <ul><li> bar <span>[[foo]]</span></li></ul> -<ul><li>=bar <span>[[foo]]</span></li></ul> -<ul><li>[[bar <span>[[foo]]</span></li></ul> -<ul><li>]]bar <span>[[foo]]</span></li></ul> -<ul><li>=bar <span>foo]]</span>=</li></ul> +<ul><li> =bar <span>[[foo]]</span></li></ul> +<ul><li> [[bar <span>[[foo]]</span></li></ul> +<ul><li> ]]bar <span>[[foo]]</span></li></ul> +<ul><li> =bar <span>foo]]</span>=</li></ul> <ul><li> <s></s>: a</li></ul> +<ul><li> <i>* foo</i></li></ul> !!end !! test Lists: 6. Escape bullets in SOL position !! options -parsoid +parsoid=html2wt !! wikitext -<!--cmt--><nowiki>*foo</nowiki> +<!--cmt--><nowiki>*</nowiki>foo !! html -<p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p> +<p><!--cmt-->*foo</p> !!end !! test @@ -20328,22 +20347,33 @@ </p> !!end +!! test +Lists: 8. Escape colons only if not present in tags +!! options +parsoid=html2wt +!! wikitext +; <nowiki>a:b</nowiki>''c:d'' +!! html +<dl><dt>a:b<i>c:d</i></dt></dl> +!! end + #### --------------- HRs --------------- #### 1. Single line #### ----------------------------------- !! test HRs: 1. Single line -!! options -parsoid !! wikitext ----<nowiki>----</nowiki> ----=foo= ----*foo -!! html -<hr><p><span typeof="mw:Nowiki">----</span></p> -<hr><p>=foo=</p> -<hr><p>*foo</p> +!! html+tidy +<hr /> +<p>----</p> +<hr /> +<p>=foo=</p> +<hr /> +<p>*foo</p> !! end #### --------------- Tables --------------- @@ -20407,127 +20437,196 @@ Tables: 2a. Nested in td !! options parsoid=html2wt +!! html/parsoid +<table><tbody><tr> +<td>foo|bar</td></tr> +<tr><td>x<div>a|b</div></td> +</tbody></table> !! wikitext {| |<nowiki>foo|bar</nowiki> |- |x<div><nowiki>a|b</nowiki></div> |} -!! html -<table><tbody><tr> -<td>foo|bar</td></tr> -<tr><td>x<div>a|b</div></td> -</tbody></table> +!! html/php+tidy +<table> +<tr> +<td>foo|bar</td> +</tr> +<tr> +<td>x +<div>a|b</div> +</td> +</tr> +</table> !! end !! test Tables: 2b. Nested in td !! options -parsoid +parsoid=html2wt +!! html/parsoid +<table><tbody><tr> +<td>foo||bar</td> +<td>a<i>b||c</i></td> +<td>a<i><div>b||c</div></i></td> +</tr></tbody></table> !! wikitext {| |<nowiki>foo||bar</nowiki> -|''it''<nowiki>foo||bar</nowiki> +|a''<nowiki>b||c</nowiki>'' +|a''<div><nowiki>b||c</nowiki></div>'' |} -!! html -<table><tbody><tr> -<td><span typeof="mw:Nowiki">foo||bar</span></td> -<td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table> +!! html/php +<table> +<tr> +<td>foo||bar +</td> +<td>a<i>b||c</i> +</td> +<td>a<i><div>b||c</div></i> +</td></tr></table> + !! end !! test Tables: 2c. Nested in td -- no escaping needed -!! options -parsoid !! wikitext {| + |foo!!bar |} -!! html -<table><tbody><tr><td>foo!!bar -</td></tr></tbody></table> +!! html/* +<table> + +<tr> +<td>foo!!bar +</td></tr></table> !! end !! test Tables: 3a. Nested in th -!! options -parsoid !! wikitext {| + !foo!bar |} -!! html -<table><tbody><tr><th>foo!bar -</th></tr></tbody></table> +!! html/* +<table> + +<tr> +<th>foo!bar +</th></tr></table> !! end !! test Tables: 3b. Nested in th !! options -parsoid +parsoid=html2wt +!! html/parsoid +<table><tbody> +<tr><th>foo!!bar</th> +<th><i>foo|bar</i></th> +<th><i>foo!!bar</i></th> +<th><i><span>foo!!bar</span></i></th> +</tr></tbody></table> !! wikitext {| !<nowiki>foo!!bar</nowiki> +!''<nowiki>foo|bar</nowiki>'' +!''<nowiki>foo!!bar</nowiki>'' +!''<span><nowiki>foo!!bar</nowiki></span>'' |} -!! html +!! html/php <table> -<tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr> -</tbody></table> +<tr> +<th>foo!!bar +</th> +<th><i>foo|bar</i> +</th> +<th><i>foo!!bar</i> +</th> +<th><i><span>foo!!bar</span></i> +</th></tr></table> + !! end !! test -Tables: 3c. Nested in th -- no escaping needed +Tables: 3c. Nested in th !! options -parsoid +parsoid=html2wt +!! html/parsoid +<table><tbody> +<tr><th>foo||bar</th> +<th><span typeof="mw:Nowiki">foo||bar</span></th> +</tr></tbody></table> !! wikitext {| !<nowiki>foo||bar</nowiki> +!<nowiki>foo||bar</nowiki> |} -!! html -<table><tbody><tr> -<th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table> +!! html/php +<table> +<tr> +<th>foo||bar +</th> +<th>foo||bar +</th></tr></table> + !! end !! test Tables: 4a. Escape - !! options -parsoid +parsoid=html2wt !! wikitext {| + !-bar + |- |<nowiki>-bar</nowiki> |} -!! html -<table><tbody> -<tr><th>-bar</th></tr> +!! html/* +<table> + <tr> -<td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table> +<th>-bar +</th></tr> +<tr> +<td>-bar +</td></tr></table> + !! end !! test Tables: 4b. Escape + !! options -parsoid +parsoid=html2wt !! wikitext {| + !+bar + |- |<nowiki>+bar</nowiki> |} -!! html -<table><tbody> -<tr><th>+bar</th></tr> +!! html/* +<table> + <tr> -<td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table> +<th>+bar +</th></tr> +<tr> +<td>+bar +</td></tr></table> + !! end !! test Tables: 4c. No escaping needed -!! options -parsoid !! wikitext {| |foo-bar @@ -20544,7 +20643,31 @@ |x <div>a|b</div> |} -!! html +!! html/php +<table> +<tr> +<td>foo-bar +</td> +<td>foo+bar +</td></tr> +<tr> +<td><i>foo</i>-bar +</td> +<td><i>foo</i>+bar +</td></tr> +<tr> +<td>foo +<p>bar|baz ++bar +-bar +</p> +</td></tr> +<tr> +<td>x +<div>a|b</div> +</td></tr></table> + +!! html/parsoid <table><tbody> <tr><td>foo-bar</td><td>foo+bar</td></tr> <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr> @@ -20559,15 +20682,23 @@ !! test Tables: 4d. No escaping needed -!! options -parsoid !! wikitext {| |[[Foo]]-bar ||+1 ||-2 |} -!! html +!! html/php +<table> +<tr> +<td><a href="/wiki/Foo" title="Foo">Foo</a>-bar +</td> +<td>+1 +</td> +<td>-2 +</td></tr></table> + +!! html/parsoid <table> <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td> <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td> @@ -20814,6 +20945,18 @@ ISBN 1234567890's !! end +!! test +Links 13: Protect link-like plain text. (Parsoid bug T78425) +!! options +parsoid=html2wt +!! html/* +<p>this is not a link: http://example.com +</p> +!! wikitext +this is not a link: <nowiki>http://example.com</nowiki> +!! end + + #### --------------- Quotes --------------- #### 1. Quotes inside <b> and <i> #### 2. Link fragments separated by <i> and <b> tags @@ -20821,7 +20964,7 @@ #### 4. No escaping needed #### -------------------------------------- !! test -1. Quotes inside <b> and <i> +1a. Quotes inside <b> and <i> !! options parsoid=html2wt,wt2wt !! wikitext @@ -20834,14 +20977,16 @@ '''<nowiki>'''foo'''</nowiki>''' '''foo'<nowiki/>''bar'<nowiki/>''baz''' '''foo'''<nowiki/>'s -'<nowiki/>''foo'' +'''foo'' ''foo''<nowiki/>' +''foo'<nowiki/>''<nowiki/>' '<nowiki/>''foo''<nowiki/>' -'<nowiki/>'''foo''' +''''foo''' '''foo'''<nowiki/>' '<nowiki/>'''foo'''<nowiki/>' ''fools'<span> errand</span>'' ''<span>fool</span>'s errand'' +a|!*#-:;+-~[]{}b'''x'' !! html/* <p><i>'foo'</i> <i>''foo''</i> @@ -20854,13 +20999,31 @@ <b>foo</b>'s '<i>foo</i> <i>foo</i>' +<i>foo'</i>' '<i>foo</i>' '<b>foo</b> <b>foo</b>' '<b>foo</b>' <i>fools'<span> errand</span></i> <i><span>fool</span>'s errand</i> +a|!*#-:;+-~[]{}b'<i>x</i> </p> +!! end + +!! test +1b. Quotes inside <b> and <i> with other chars +!! options +parsoid=html2wt,wt2wt +!! wikitext +'''a'' foo ''[[bar]]'' +''a''' foo ''[[bar]]'' +''a''' foo '''{{echo|[[bar]]}}''' +[[foo]] x'''[[bar]]'' +!! html +'<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i> +<i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i> +<i>a'</i> foo <b><a rel="mw:WikiLink" href="Bar" title="Bar" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[bar]]"}},"i":0}}]}'>bar</a></b> +<a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i> !! end !! test @@ -20894,9 +21057,11 @@ !! wikitext '<span>''bar''</span>' '<span>'''bar'''</span>' +'a:b'foo !! html <p>'<span><i>bar</i></span>' '<span><b>bar</b></span>' +'a:b'foo </p> !! end @@ -22400,6 +22565,36 @@ <p><i>A</i><b><i>B</i></b></p> !! end +!! test +5a. Merge adjacent quote nodes if they've been edited +!! options +parsoid={ + "modes": ["wt2wt"], + "changes": [ + ["p", "contents", "remove", ":contains('b')"] + ] +} +!! wikitext +''a''b''c'' +!! wikitext/edited +''ac'' +!! end + +!! test +5b. Merge adjacent quote nodes if they've been edited +!! options +parsoid={ + "modes": ["wt2wt"], + "changes": [ + ["#x", "remove"] + ] +} +!! wikitext +''a''<span id="x">b</span>''c'' +!! wikitext/edited +''ac'' +!! end + #------------------------------------ # End of I/B quote minimization tests #------------------------------------ -- To view, visit https://gerrit.wikimedia.org/r/181134 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic972e272be9deea6b44b2375fa31ac128e452dac Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Paladox <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
