tree-selector
Advanced tools
Comparing version
@@ -107,3 +107,7 @@ "use strict"; | ||
} | ||
return parseFloat(v); | ||
var f = parseFloat(v); | ||
if (isNaN(f)) { | ||
return v; | ||
} | ||
return f; | ||
} | ||
@@ -110,0 +114,0 @@ function postProcessPseudos(sel) { |
@@ -104,3 +104,7 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
} | ||
return parseFloat(v); | ||
var f = parseFloat(v); | ||
if (isNaN(f)) { | ||
return v; | ||
} | ||
return f; | ||
} | ||
@@ -107,0 +111,0 @@ function postProcessPseudos(sel) { |
{ | ||
"name": "tree-selector", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Use CSS selectors to match nodes in a custom object tree", | ||
@@ -5,0 +5,0 @@ "main": "lib/cjs/index.js", |
@@ -144,3 +144,7 @@ export interface Selector { | ||
} | ||
return parseFloat(v); | ||
const f = parseFloat(v); | ||
if(isNaN(f)) { | ||
return v; | ||
} | ||
return f; | ||
} | ||
@@ -147,0 +151,0 @@ |
@@ -169,2 +169,19 @@ import { parseSelector } from '../src/index'; | ||
}); | ||
it('should parse attribute selector string without quotes', () => { | ||
const selector = '[data-something=foo]'; | ||
const result = parseSelector(selector); | ||
const expected = { | ||
id: '', | ||
tag: '', | ||
classList: [], | ||
attributes: { | ||
'data-something': ['exact', 'foo'] | ||
}, | ||
nextSelector: undefined, | ||
pseudos: [] | ||
}; | ||
assert.deepStrictEqual(result, expected); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
136801
0.99%1690
1.62%