Talk:Specs/HTML
Add topicAppearance
(Redirected from Talk:Parsoid/MediaWiki DOM spec)
Latest comment: 9 years ago by Amire80 in topic The about attribute
The about attribute
[edit]Is it guaranteed that groups of related elements will always be connected using the "about" attribute?
In ContentTranslation we are removing templates and <timeline>s from Parsoid-based DOM, and we find all the related elements using this code (redacted):
$( '[typeof*="mw:Transclusion"], [typeof*="mw:Extension/timeline"]' ).each( function () {
var $element = $( this ),
about = $element.attr( 'about' );
if ( about ) {
$( '[about="' + about + '"]' ).remove();
}
$element.remove();
} );
The questions are:
- Is every Transclusion and Extension/timeline element guaranteed to have an "about" attribute?
- If all the related elements have the same value in the "about" attribute, will it be enough to just do
$( '[about="' + about + '"]' ).remove();
and discard$element.remove()
?
(FYI, Santhosh.thottingal.) --Amir E. Aharoni (talk) 16:02, 31 December 2014 (UTC)
- Amir, the answer to 1) is yes. The 'about' attribute is always set, so that we can consistently identify templated or extension content that produces several sibling nodes. 2) is more of a jquery question. Without having tried it, I would say that yes it should work. Just give it a try (and report back, for others benefit) ;) -- Gabriel Wicke (GWicke) (talk) 16:42, 31 December 2014 (UTC)
- Thanks.
- Looks like it works, though I didn't test with a lot of articles: https://gerrit.wikimedia.org/r/#/c/182174/ . --Amir E. Aharoni (talk) 16:55, 31 December 2014 (UTC)