Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

denjs

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

denjs

den, A DOM utility library that uses native methods and returns native HTMLElement. ================

  • 1.0.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

den, A DOM utility library that uses native methods and returns native HTMLElement.

Idea: Native APIs are first-class citizen, always return native HTMLElement.

USAGE

- node is element or text node
- element is element
- text is text node

if not defined $ and $$, it will define
  window.$ = function(selector) { return typeof selector === "string" ? document.querySelector(selector) : selector || null }
  window.$$ = function(selector) { return [].slice.call(document.querySelectorAll(selector)) }

den("#parent").insertAfter(node, $("#child-a"))
[].slice.call(x.childNodes)

API

den(selector) -> <#Den>

- closest(selectorString) -> HTMLElement
- isAncestor(ancestorNode)
- insertAfter(newNode, referenceNode)
- remove()

###########
# Class methods
###########

- den.isNode(obj) .. isElement isText isDocument isWindow
- den.isIE(maxVersion) .. isIOS isMac
- den.createElement(htmlText) -> HTMLElement
- den.keystroke(event) -> "a" "ctrl-a" "ctrl-alt-shift-cmd-a"

Install

$ npm install denjs --save
$ boewr install denjs --save

TODO

from medium-editor selection.js

getSelectedElements: function (doc) {
rangeSelectsSingleNode: function (range) {
getSelectedParentElement: function (range) {
getCaretOffsets: function getCaretOffsets(element, range) {
getSelectionHtml: function getSelectionHtml(doc) {
importSelection: function (selectionState, root, doc, favorLaterSelectionAnchor) {
exportSelection: function (root, doc) {

from quill lib/dom.js

...

FAQs

Package last updated on 29 Sep 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc