Skip to content

Commit fa832aa

Browse files
committed
add double-negative attr value check in strict-d3
1 parent 4f75015 commit fa832aa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/image/strict-d3.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,18 @@ selProto.style = function() {
4646
return originalSelStyle.apply(sel, arguments);
4747
};
4848

49-
function checkAttrVal(sel, key) {
49+
function checkAttrVal(sel, key, val) {
5050
// setting the transform attribute on a <clipPath> does not
5151
// work in Chrome, IE and Edge
5252
if(sel.node().nodeName === 'clipPath' && key === 'transform') {
5353
throw new Error('d3 selection.attr called with key \'transform\' on a clipPath node');
5454
}
55+
56+
// make sure no double-negative string get into the DOM,
57+
// their handling differs from browsers to browsers
58+
if(/--/.test(val)) {
59+
throw new Error('d3 selection.attr called with value ' + val + ' which includes a double negative');
60+
}
5561
}
5662

5763
function checkStyleVal(sel, key, val) {

0 commit comments

Comments
 (0)