phosphor-domutil
Utilities for working with the DOM.
Package Install
Prerequisites
npm install --save phosphor-domutil
Source Build
Prerequisites
git clone https://github.com/phosphorjs/phosphor-domutil.gitcd phosphor-domutilnpm install
Rebuild
npm run cleannpm run build
Run Tests
Follow the source build instructions first.
# run tests in Firefox npm test # run tests in Chrome npm run test:chrome # run tests in IE npm run test:ie
Build Docs
Follow the source build instructions first.
npm run docs
Navigate to docs/index.html
.
Supported Runtimes
The runtime versions which are currently known to work are listed below. Earlier versions may also work, but come with no guarantees.
- IE 11+
- Firefox 32+
- Chrome 38+
Bundle for the Browser
Follow the package install instructions first.
npm install --save-dev browserify browserify-cssbrowserify myapp.js -o mybundle.js
Usage Examples
Note: This module is fully compatible with Node/Babel/ES6/ES5. Simply omit the type declarations when using a language other than TypeScript.
Cursor Override:
; // force the cursor to be 'wait' for the entire document; // clear the override by disposing the return valueoverride.dispose;
Hit Testing:
; ;div.style.position = 'absolute';div.style.left = '0px';div.style.top = '0px';div.style.width = '100px';div.style.height = '100px';document.body.appendChilddiv; hitTestdiv, 50, 50; // truehitTestdiv, 150, 150; // false
Box Sizing:
; ;div.style.borderTop = 'solid 10px black';document.body.appendChilddiv; ;sizing.borderTop; // 10sizing.paddingLeft; // 0// etc...
Size Limits:
; ;div.style.minWidth = '90px';document.body.appendChilddiv; ;limits.minWidth; // 90limits.maxHeight; // Infinity// etc...
Custom Drag Data:
; // pseudo-code // pseudo-code