https://bugzilla.wikimedia.org/show_bug.cgi?id=27073

           Summary: Css target selector for css additions to document
                    should not append target if missing.
           Product: MediaWiki
           Version: wikimedia-deployment
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Normal
         Component: Resource Loader
        AssignedTo: tpars...@wikimedia.org
        ReportedBy: d...@ucsc.edu
                CC: roan.katt...@gmail.com


You have the code: 
// Marker element for adding dynamic styles
var $marker = $( 'head meta[name=ResourceLoaderDynamicStyles]' );

You should instead have: 
var $marker = null and then use this.getCssMarker() or getCssMarker() and
locally cache the selector so you can lazy initialize the target ( and do
things like add the target to the page if its missing )

something like: 

// Marker element for adding dynamic styles
var $marker = null ; // lazy init
var getMarker = function(){
if( $marker ){
    return $marker;
}
$marker = $( 'head meta[name=ResourceLoaderDynamicStyles]' )
if( ! $marker.length ){
    $marker = $( '<meta />').attr( 'name', 'ResourceLoaderDynamicStyles' )
          .appendTo( 'head' );
    }
return $marker;
};

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to