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) {
39
39
}
40
40
var root = config . root ;
41
41
var links = attrParse ( content , function ( tag , attr ) {
42
- var item = tag + ":" + attr ;
43
42
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
+ }
45
48
} ) ;
46
49
return ! ! res ;
47
50
} ) ;
Original file line number Diff line number Diff line change @@ -36,6 +36,13 @@ describe("loader", function() {
36
36
'module.exports = "Text <custom-element custom-src=\\"" + require("./image1.png") + "\\"><custom-img custom-src=\\"" + require("./image2.png") + "\\"/></custom-element>";'
37
37
) ;
38
38
} ) ;
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
+ } ) ;
39
46
it ( "should not make bad things with templates" , function ( ) {
40
47
loader . call ( { } , '<h3>#{number} {customer}</h3>\n<p> {title} </p>' ) . should . be . eql (
41
48
'module.exports = "<h3>#{number} {customer}</h3>\\n<p> {title} </p>";'
You can’t perform that action at this time.
0 commit comments