Item13791: Backport CSS classes in script/link/style elements in zones for 1.1.x.
Priority: Enhancement
Current State: Closed
Released In: 1.1.10
Target Release: patch
Applies To: Engine
Component:
Branches: Release01x01
... Required for
AngularSkin and
RenderPlugin to properly inject css and js as required by TML snippets loaded async'ly
diff --git a/lib/Foswiki.pm b/lib/Foswiki.pm
index 17e2e22..c1d17ba 100644
--- a/lib/Foswiki.pm
+++ b/lib/Foswiki.pm
@@ -3457,6 +3457,11 @@ sub addToZone {
$thisZone->{$id} = $zoneID;
}
+ # add class to script and link data
+ $data =~ s/<script\s+((?![^>]*class=))/<script class='\$zone \$id' $1/g;
+ $data =~ s/<link\s+((?![^>]class=))/<link class='\$zone \$id' $1/g;
+ $data =~ s/<style\s+((?![^>]*class=))/<style class='\$zone \$id' $1/g;
+
# override previous properties
$zoneID->{zone} = $zone;
$zoneID->{requires} = \@requires;
--
MichaelDaum - 05 Oct 2015