Page MenuHomePhabricator

ResourceLoaderDynamicStyles should be dynamically appended to the document if it doesn't exist
Closed, ResolvedPublic

Description

Author: mdale

Description:
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;
};


Version: unspecified
Severity: enhancement

Details

Reference
bz27073

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:20 PM
bzimport set Reference to bz27073.

mdale wrote:

patch for adding getMarker

here is the comment in patch form .. if that helps.

Attached:

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*