Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Liberal JavaScript DOM builder
Generate a DOM Element. Accepts a variable number of arguments which may be:
Hashes of attributes
Elements
Strings of content
Arrays (which can be nested) of any of the above
Function to call, which should return any of the above
div = Builder 'div', className: 'tasty' ul = Builder.ul Builder.li 'Item One'
All HTML5 tag names are available as functions on the Builder object which will generate the corresponding element. For maximum readability when generating multiple elements it can be useful to a function with Builder as the context:
table = (->
@table cellpadding: 0, cellspacing: 0,
@tbody(
@tr(
@td 'Cell One'
@td 'Cell Two'
)
)
).call Builder
If no document is present in the global scope (i.e. on Node), you can explicitly set the document element:
jsdom = require 'jsdom'
Builder = require 'builder'
window = jsdom.createWindow()
Builder.document = window.document
div = Builder.div()
Setting $ on Builder will make Builder return a wrapped object containing the element (i.e. a jQuery/Zepto/Ender array). Builder will always look inside these objects for the actual elements so in practice you can use them as if they were the Element objects, with the added benefit of attaching event handlers inline, etc:
Builder.$ = jQuery
list = (->
@ul @li @a('Link',href:'#').click ->
).call Builder
When including builder in an Ender build, it becomes available as $.builder:
div = $.builder 'div'
FAQs
An NPM-based task runner
The npm package builder receives a total of 1,092 weekly downloads. As such, builder popularity was classified as popular.
We found that builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 32 open source maintainers 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
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.