File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -39,9 +39,12 @@ module.exports = function(content) {
3939 }
4040 var root = config . root ;
4141 var links = attrParse ( content , function ( tag , attr ) {
42- var item = tag + ":" + attr ;
4342 var res = attributes . find ( function ( a ) {
44- return item . indexOf ( a ) >= 0 ;
43+ if ( a . charAt ( 0 ) === ':' ) {
44+ return attr === a . slice ( 1 ) ;
45+ } else {
46+ return ( tag + ":" + attr ) === a ;
47+ }
4548 } ) ;
4649 return ! ! res ;
4750 } ) ;
Original file line number Diff line number Diff line change @@ -36,6 +36,13 @@ describe("loader", function() {
3636 'module.exports = "Text <custom-element custom-src=\\"" + require("./image1.png") + "\\"><custom-img custom-src=\\"" + require("./image2.png") + "\\"/></custom-element>";'
3737 ) ;
3838 } ) ;
39+ it ( "should accept :attribute (empty tag) from query and not collide with similar attributes" , function ( ) {
40+ loader . call ( {
41+ query : "?attrs[]=:custom-src"
42+ } , 'Text <custom-element custom-src="image1.png" custom-src-other="other.png"><custom-img custom-src="image2.png"/></custom-element>' ) . should . be . eql (
43+ 'module.exports = "Text <custom-element custom-src=\\"" + require("./image1.png") + "\\" custom-src-other=\\"other.png\\"><custom-img custom-src=\\"" + require("./image2.png") + "\\"/></custom-element>";'
44+ ) ;
45+ } ) ;
3946 it ( "should not make bad things with templates" , function ( ) {
4047 loader . call ( { } , '<h3>#{number} {customer}</h3>\n<p> {title} </p>' ) . should . be . eql (
4148 'module.exports = "<h3>#{number} {customer}</h3>\\n<p> {title} </p>";'
You can’t perform that action at this time.
0 commit comments