@@ -37,7 +37,7 @@ var isTemplate = function (content) {
3737} ;
3838
3939// AttributeContext class
40- var AttributeContext = function ( isRelevantTagAttr , usid , root ) {
40+ var AttributeContext = function ( isRelevantTagAttr , usid , root , parseDynamicRoutes ) {
4141 this . currentDirective = null ;
4242 this . matches = [ ] ;
4343 this . isRelevantTagAttr = isRelevantTagAttr ;
@@ -47,6 +47,7 @@ var AttributeContext = function (isRelevantTagAttr, usid, root) {
4747 } ;
4848 this . data = { } ;
4949 this . root = root ;
50+ this . parseDynamicRoutes = parseDynamicRoutes ;
5051} ;
5152
5253AttributeContext . prototype . replaceMatches = function ( content ) {
@@ -56,8 +57,10 @@ AttributeContext.prototype.replaceMatches = function(content) {
5657
5758 this . matches . forEach ( function ( match ) {
5859 if ( isTemplate ( match . value ) ) {
59- // Replate template if a "root" option has been defined
60- if ( pathIsAbsolute ( match . value ) && self . root != undefined ) {
60+ // Replace attribute value
61+ // This is used if it contains a template expression and both the "root" and "parseDynamicRoutes"
62+ // were defined
63+ if ( pathIsAbsolute ( match . value ) && self . root !== undefined ) {
6164 var x = content . pop ( ) ;
6265 content . push ( x . substr ( match . start + match . length ) ) ;
6366 content . push ( match . expression ) ;
@@ -126,7 +129,7 @@ var processMatch = function (match, strUntilValue, name, value, index) {
126129
127130 // Try and set "root" directory when a dynamic attribute is found
128131 if ( isTemplate ( value ) ) {
129- if ( pathIsAbsolute ( value ) && self . root != undefined ) {
132+ if ( pathIsAbsolute ( value ) && self . root !== undefined && self . parseDynamicRoutes ) {
130133 // Generate new value for replacement
131134 expression = loaderUtils . urlToRequest ( value , self . root ) ;
132135 }
@@ -164,7 +167,7 @@ var specs = {
164167
165168var parser = new Parser ( specs ) ;
166169
167- module . exports = function parse ( html , isRelevantTagAttr , usid , root ) {
168- var context = new AttributeContext ( isRelevantTagAttr , usid , root ) ;
170+ module . exports = function parse ( html , isRelevantTagAttr , usid , root , parseDynamicRoutes ) {
171+ var context = new AttributeContext ( isRelevantTagAttr , usid , root , parseDynamicRoutes ) ;
169172 return parser . parse ( 'outside' , html , context ) ;
170173} ;
0 commit comments