jenkins-bot has submitted this change and it was merged.

Change subject: Template, Images, References: Use attributeContains selector 
for typeof attribute
......................................................................


Template, Images, References: Use attributeContains selector for typeof 
attribute

The typeof attribute that we rely based on
https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec may not be a single
string value. For exammple typeof="mw:Extension/indicator mw:Transclusion"
is a valid and usually occuring value in the Parsoid HTML output.

So use attributeContains selector [typeof*=value] to avoid missing to
detect templates, images and references

Search for typeof="mw:Extension/indicator mw:Transclusion" in
http://parsoid.wmflabs.org/frwiki/France to see an example

Change-Id: Ie946fa3f7d5098a61129de732cf468dd15f87073
---
M modules/source/ext.cx.source.filter.js
M modules/tools/ext.cx.tools.reference.js
M modules/tools/ext.cx.tools.template.js
3 files changed, 6 insertions(+), 6 deletions(-)

Approvals:
  Jsahleen: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/source/ext.cx.source.filter.js 
b/modules/source/ext.cx.source.filter.js
index ae464b5..a8633ba 100644
--- a/modules/source/ext.cx.source.filter.js
+++ b/modules/source/ext.cx.source.filter.js
@@ -63,7 +63,7 @@
        CXSourceFilter.prototype.filter = function ( configuration ) {
                var sourceFilter = this;
 
-               $( '[typeof="mw:Transclusion"]' ).each( function () {
+               $( '[typeof*="mw:Transclusion"]' ).each( function () {
                        var title, mwData, templateName, templateConf,
                                $template = $( this );
 
diff --git a/modules/tools/ext.cx.tools.reference.js 
b/modules/tools/ext.cx.tools.reference.js
index a5fb4b4..7084659 100644
--- a/modules/tools/ext.cx.tools.reference.js
+++ b/modules/tools/ext.cx.tools.reference.js
@@ -162,7 +162,7 @@
                        return mwData;
                }
 
-               $referenceSiblings = $( '[typeof="mw:Extension/references"]' )
+               $referenceSiblings = $( '[typeof*="mw:Extension/references"]' )
                        .find( 'a[href="#' + referenceId + '"]' )
                        .siblings();
                for ( i = 0; i < $referenceSiblings.length; i++ ) {
@@ -204,7 +204,7 @@
                                <span>Reference content html goes here</span>
                </li>
                */
-               adaptedData = $( '[typeof="mw:Extension/references"]' )
+               adaptedData = $( '[typeof*="mw:Extension/references"]' )
                        .find( 'a[href="#' + referenceId + '"]' )
                        .parent()
                        .next()
@@ -216,7 +216,7 @@
 
        function processReferences( $section ) {
                var referenceAdaptor = new ReferenceCard();
-               $section.find( '[typeof="mw:Extension/ref"]' ).each( function 
() {
+               $section.find( '[typeof*="mw:Extension/ref"]' ).each( function 
() {
                        var $reference = $( this ),
                                referenceId = $reference.prop( 'id' );
 
diff --git a/modules/tools/ext.cx.tools.template.js 
b/modules/tools/ext.cx.tools.template.js
index 5da3039..4f86d9c 100644
--- a/modules/tools/ext.cx.tools.template.js
+++ b/modules/tools/ext.cx.tools.template.js
@@ -206,10 +206,10 @@
        function processTemplates( $section ) {
                var templates = [];
 
-               if ( $section.is( '[typeof="mw:Transclusion"]' ) ) {
+               if ( $section.is( '[typeof*="mw:Transclusion"]' ) ) {
                        templates.push( $section );
                } else {
-                       templates = $section.find( '[typeof="mw:Transclusion"]' 
);
+                       templates = $section.find( 
'[typeof*="mw:Transclusion"]' );
                }
                $.each( templates, function () {
                        var template = new TemplateTool( this );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie946fa3f7d5098a61129de732cf468dd15f87073
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>
Gerrit-Reviewer: Jsahleen <jsahl...@wikimedia.org>
Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to