@mariusandra/simmerjs
Advanced tools
Comparing version 0.5.6-posthog-2 to 0.6.0-posthog.1
@@ -7,2 +7,6 @@ 'use strict'; | ||
var _inspectDataAttr = require('./inspectDataAttr'); | ||
var _inspectDataAttr2 = _interopRequireDefault(_inspectDataAttr); | ||
var _inspectElementID = require('./inspectElementID'); | ||
@@ -45,2 +49,3 @@ | ||
parsingMethods.addMethod(_inspectDataAttr2.default); | ||
parsingMethods.addMethod(_inspectElementID2.default); | ||
@@ -47,0 +52,0 @@ parsingMethods.addMethod(_inspectTags2.default); |
@@ -7,2 +7,3 @@ 'use strict'; | ||
exports.isUniqueElementID = isUniqueElementID; | ||
exports.isUniqueDataAttr = isUniqueDataAttr; | ||
exports.wrap = wrap; | ||
@@ -30,2 +31,8 @@ | ||
function isUniqueDataAttr(query, dataAttr) { | ||
// use selector to query an element and see if it is a one-to-one selection | ||
var results = query('[data-attr="' + dataAttr + '"]') || []; | ||
return results.length === 1; | ||
} | ||
function traverseAttribute(el, dir) { | ||
@@ -32,0 +39,0 @@ var matched = []; |
@@ -0,1 +1,2 @@ | ||
import inspectDataAttr from './inspectDataAttr' | ||
import inspectElementID from './inspectElementID' | ||
@@ -22,2 +23,3 @@ import inspectTags from './inspectTags' | ||
parsingMethods.addMethod(inspectDataAttr) | ||
parsingMethods.addMethod(inspectElementID) | ||
@@ -24,0 +26,0 @@ parsingMethods.addMethod(inspectTags) |
@@ -12,2 +12,8 @@ /** | ||
export function isUniqueDataAttr (query, dataAttr) { | ||
// use selector to query an element and see if it is a one-to-one selection | ||
var results = query(`[data-attr="${dataAttr}"]`) || [] | ||
return results.length === 1 | ||
} | ||
function traverseAttribute (el, dir) { | ||
@@ -14,0 +20,0 @@ const matched = [] |
{ | ||
"name": "@mariusandra/simmerjs", | ||
"description": "A pure Javascript reverse CSS selector engine which calculates a DOM element's unique CSS selector on the current page.", | ||
"version": "0.5.6-posthog-2", | ||
"version": "0.6.0-posthog.1", | ||
"author": "Gidi Meir Morris", | ||
@@ -6,0 +6,0 @@ "main": "lib/simmer.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
108803
49
1734