From: Kaldari Date: Wed, 6 Mar 2013 01:07:25 +0000 (-0800) Subject: Reverting temporary change Iedb304f8 as promised X-Git-Tag: 1.31.0-rc.0~20469 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=851f669b185f2b0570d78b3c0ffd209c983b880f;p=lhc%2Fweb%2Fwiklou.git Reverting temporary change Iedb304f8 as promised Change-Id: Id2d0e2242cfb3fe84b68c5bfb8ab7c74fdf92f7d --- diff --git a/resources/mediawiki/mediawiki.jqueryMsg.js b/resources/mediawiki/mediawiki.jqueryMsg.js index 76f02593cd..183b525e8d 100644 --- a/resources/mediawiki/mediawiki.jqueryMsg.js +++ b/resources/mediawiki/mediawiki.jqueryMsg.js @@ -662,9 +662,9 @@ $span.append( childNode ); } ); } else { - // strings, integers, anything else - // (will soon switch to createTextNode() for non-objects) - $span.append( node ); + // Let jQuery append nodes, arrays of nodes and jQuery objects + // other things (strings, numbers, ..) are appended as text nodes (not as HTML strings) + $span.append( $.type( node ) === 'object' ? node : document.createTextNode( node ) ); } } ); return $span; diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js index f23964c0ec..0a9df966a8 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js @@ -81,7 +81,7 @@ } ); } - QUnit.test( 'Replace', 7, function ( assert ) { + QUnit.test( 'Replace', 9, function ( assert ) { var parser = mw.jqueryMsg.getMessageFunction(); mw.messages.set( 'simple', 'Foo $1 baz $2' ); @@ -90,7 +90,6 @@ assert.equal( parser( 'simple', 'bar' ), 'Foo bar baz $2', 'Replacements with less substitutes' ); assert.equal( parser( 'simple', 'bar', 'quux' ), 'Foo bar baz quux', 'Replacements with all substitutes' ); - /* Temporarily disabling until 2013-03 --Kaldari mw.messages.set( 'plain-input', 'x$1y<z' ); assert.equal( @@ -106,7 +105,6 @@ 'Foo <bar bar="bar">&gt;</bar>', 'Replacement is not considered html' ); - */ mw.messages.set( 'object-replace', 'Foo $1' );