mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
Merge "Minor: trace output tweak + code refactoring"
This commit is contained in:
commit
96c9d4cb67
|
@ -334,16 +334,17 @@ Sanitizer.prototype.onAny = function ( token ) {
|
||||||
if ( token.attribs && token.attribs.length ) {
|
if ( token.attribs && token.attribs.length ) {
|
||||||
var attribs = token.attribs.slice();
|
var attribs = token.attribs.slice();
|
||||||
var newToken = $.extend( {}, token );
|
var newToken = $.extend( {}, token );
|
||||||
|
var env = this.manager.env;
|
||||||
for ( var i = 0, l = attribs.length; i < l; i++ ) {
|
for ( var i = 0, l = attribs.length; i < l; i++ ) {
|
||||||
var kv = attribs[i],
|
var kv = attribs[i],
|
||||||
k = kv.k,
|
k = kv.k,
|
||||||
v = kv.v;
|
v = kv.v;
|
||||||
|
|
||||||
if ( k.constructor === Array ) {
|
if ( k.constructor === Array ) {
|
||||||
k = this.manager.env.tokensToString ( k );
|
k = env.tokensToString ( k );
|
||||||
}
|
}
|
||||||
if ( v.constructor === Array ) {
|
if ( v.constructor === Array ) {
|
||||||
v = this.manager.env.tokensToString ( v );
|
v = env.tokensToString ( v );
|
||||||
}
|
}
|
||||||
if ( k === 'style' ) {
|
if ( k === 'style' ) {
|
||||||
v = this.checkCss(v);
|
v = this.checkCss(v);
|
||||||
|
|
|
@ -94,9 +94,18 @@ TagTk.prototype.tagToStringFns = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TagTk.prototype.toString = function() {
|
TagTk.prototype.toString = function(compact) {
|
||||||
if (this.dataAttribs.stx && this.dataAttribs.stx === "html") {
|
if (this.dataAttribs.stx && this.dataAttribs.stx === "html") {
|
||||||
return "<HTML:" + this.name + ">";
|
if (compact) {
|
||||||
|
return "<HTML:" + this.name + ">";
|
||||||
|
} 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 "<HTML:" + this.name + " " + buf.join(' ') + ">";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var f = this.tagToStringFns[this.name];
|
var f = this.tagToStringFns[this.name];
|
||||||
return f ? f.bind(this)() : this.defaultToString();
|
return f ? f.bind(this)() : this.defaultToString();
|
||||||
|
|
Loading…
Reference in a new issue