diff --git a/modules/parser/ext.core.Sanitizer.js b/modules/parser/ext.core.Sanitizer.js index c691461833..4fa3373659 100644 --- a/modules/parser/ext.core.Sanitizer.js +++ b/modules/parser/ext.core.Sanitizer.js @@ -334,16 +334,17 @@ Sanitizer.prototype.onAny = function ( token ) { if ( token.attribs && token.attribs.length ) { var attribs = token.attribs.slice(); var newToken = $.extend( {}, token ); + var env = this.manager.env; for ( var i = 0, l = attribs.length; i < l; i++ ) { var kv = attribs[i], k = kv.k, v = kv.v; if ( k.constructor === Array ) { - k = this.manager.env.tokensToString ( k ); + k = env.tokensToString ( k ); } if ( v.constructor === Array ) { - v = this.manager.env.tokensToString ( v ); + v = env.tokensToString ( v ); } if ( k === 'style' ) { v = this.checkCss(v); diff --git a/modules/parser/mediawiki.parser.defines.js b/modules/parser/mediawiki.parser.defines.js index 705980ac14..259ff579c0 100644 --- a/modules/parser/mediawiki.parser.defines.js +++ b/modules/parser/mediawiki.parser.defines.js @@ -94,9 +94,18 @@ TagTk.prototype.tagToStringFns = { } }; -TagTk.prototype.toString = function() { +TagTk.prototype.toString = function(compact) { if (this.dataAttribs.stx && this.dataAttribs.stx === "html") { - return ""; + if (compact) { + return ""; + } else { + var buf = []; + for (var i = 0, n = this.attribs.length; i < n; i++) { + var a = this.attribs[i]; + buf.push(Util.toStringTokens(a.k).join('') + "=" + Util.toStringTokens(a.v).join('')); + } + return ""; + } } else { var f = this.tagToStringFns[this.name]; return f ? f.bind(this)() : this.defaultToString();