Henning Snater has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/57071


Change subject: (bug 44228) Template engine: Overriding plain() method
......................................................................

(bug 44228) Template engine: Overriding plain() method

Overriding the messaging system's plain() method in the template engine's 
Template prototype
assuring IE8 compatibility.

Change-Id: Ia063623abc1068f20bd6e59c8b7396b1f4b9e63c
---
M lib/resources/templates.js
1 file changed, 11 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/71/57071/1

diff --git a/lib/resources/templates.js b/lib/resources/templates.js
index 129c440..5aeb295 100644
--- a/lib/resources/templates.js
+++ b/lib/resources/templates.js
@@ -30,6 +30,17 @@
        );
 
        /**
+        * Returns the parsed plain template. (Overridden due to IE8 returning 
objects instead of
+        * strings from mw.Message's native plain() method.)
+        * @see mw.Message.plain
+        *
+        * @return {string}
+        */
+       mw.Template.prototype.plain = function() {
+               return this.parser();
+       };
+
+       /**
         * @see mw.Message.parser
         *
         * @return {String}
@@ -183,12 +194,10 @@
                        // jQuery parse the template will convert the tag names 
to upper case, just convert the
                        // whole string to lower case.
                        string = filteredString.toLowerCase();
-
                        return string;
                }
                strippedTemplate = strip( template.plain() );
                strippedParsedTemplate = strip( parsedTemplate );
-
                // nodes or text got lost while being parsed which indicates 
that the generated HTML would
                // be invalid
                if ( strippedTemplate !== strippedParsedTemplate ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/57071
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia063623abc1068f20bd6e59c8b7396b1f4b9e63c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Henning Snater <henning.sna...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to