mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
Don't set the data-mw attribute if the object is actually empty.
Change-Id: I984f1b44bba67d7a9f1a709738d14c0ee02f69a9
This commit is contained in:
parent
2774e5aa6c
commit
e0809209ec
|
@ -74,15 +74,15 @@ FauxHTML5.TreeBuilder.prototype._att = function (maybeAttribs) {
|
|||
FauxHTML5.TreeBuilder.prototype.processToken = function (token) {
|
||||
var attribs = token.attribs || [];
|
||||
if ( token.dataAttribs ) {
|
||||
if ( ! token.attribs ) {
|
||||
token.attribs = [];
|
||||
var dataMW = JSON.stringify( token.dataAttribs );
|
||||
if ( dataMW !== '{}' ) {
|
||||
attribs = attribs.concat([
|
||||
{
|
||||
// Mediawiki-specific round-trip / non-semantic information
|
||||
k: 'data-mw',
|
||||
v: dataMW
|
||||
} ] );
|
||||
}
|
||||
attribs = attribs.concat([
|
||||
{
|
||||
// Mediawiki-specific round-trip / non-semantic information
|
||||
k: 'data-mw',
|
||||
v: JSON.stringify( token.dataAttribs )
|
||||
} ] );
|
||||
}
|
||||
|
||||
switch( token.constructor ) {
|
||||
|
|
Loading…
Reference in a new issue