Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@knighttower/element-helper
Advanced tools
ElementHelper is a JavaScript class that adds extra functionality to interact with DOM elements. This class is part of a larger project and can be imported from the @knighttower/adaptive package.
yarn add @knighttower/element-helper
import ElementHelper from '@knighttower/element-helper';
ElementHelper
is a JavaScript class that adds extra functionality to interact with DOM elements. This class is part of a larger project and can be imported from the @knighttower/adaptive
package.
export default class ElementHelper
selector (String|Object)
: Class, ID, or DOM element.scope (String)
: The scope to search in. Defaults to document
.Object
instance of ElementHelper
.const element = new ElementHelper('elementSelector') // return the DOM element
const element = new ElementHelper('elementSelector', domElement|window|document)
constructor(selector, scope = document)
Initializes the ElementHelper
class with the given selector
and scope
.
isInDom()
Boolean
whenInDom()
Promise
getElementByXpath(xpath)
xpath (String)
Object
(DOM element)getXpathTo()
String
getAttribute(attr)
attr (String)
String|Array|Object|Null
getHash()
String
This section is reserved for future enhancements, possibly to extend the prototype of DOM elements.
const element = new ElementHelper('.my-class');
if (element.isInDom()) {
// Do something
}
element.whenInDom().then((elem) => {
// Do something when element is in DOM
});
const attrValue = element.getAttribute('data-attribute');
This documentation covers all the features, methods, and examples mentioned in the provided code. Please note that the code relies on DomObserver
from the @knighttower/js-dom-observer
package, which is not covered in this documentation.
FAQs
ElementHelper is a JavaScript class that adds extra functionality to interact with DOM elements. This class is part of a larger project and can be imported from the @knighttower/adaptive package.
The npm package @knighttower/element-helper receives a total of 2 weekly downloads. As such, @knighttower/element-helper popularity was classified as not popular.
We found that @knighttower/element-helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.