Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
get-box-quads-polyfill
Advanced tools
a polyfill for the getBoxQuads API
npm i get-box-quads-polyfill
import { addPolyfill } from "get-box-quads-polyfill";
addPolyfill(window);
now you can use the Api on objects derived from "Node" :
document.body.getBoxQuads(...)
following API's are supported:
convertQuadFromNode(quad: DOMQuadInit, from: Element, options?: { fromBox: 'margin' | 'border' | 'padding' | 'content', toBox: 'margin' | 'border' | 'padding' | 'content', iframes?: HTMLIFrameElement[] })
convertRectFromNode(rect: DOMRectReadOnly, from: Element, options?: { fromBox: 'margin' | 'border' | 'padding' | 'content', toBox: 'margin' | 'border' | 'padding' | 'content', iframes?: HTMLIFrameElement[] })
convertPointFromNode(point: DOMPoint, from: Element, options?: { fromBox: 'margin' | 'border' | 'padding' | 'content', toBox: 'margin' | 'border' | 'padding' | 'content', iframes?: HTMLIFrameElement[] })
getBoxQuads(element: Element, options?: { box: 'margin' | 'border' | 'padding' | 'content', relativeTo: Element, iframes?: HTMLIFrameElement[] })
getElementSize(node: Node) -> cause of missing offsetWidth in other node types
the API do have a non standard parameter "iframes", in wich you can hand over iframe objects in wich your elments are embeded in. This is not needed in the browser native API, but in the polyfill, the element inside of an iframe could not access it's container.
gets the 4 transformed corner points of an Elment in DOM. Works only for HTMLElements. Limited support for SVG and MathML, cause of missing offsetLeft & offsetTop-Properties on SVGElement and MathMLElement (see issue: https://github.com/w3c/csswg-drafts/issues/10514)
spec: https://www.w3.org/TR/cssom-view-1/#the-geometryutils-interface https://drafts.csswg.org/cssom-view/#dom-geometryutils-getboxquads
FF has a native implementation impl: https://bugzilla.mozilla.org/show_bug.cgi?id=918189 https://bugzilla.mozilla.org/show_bug.cgi?id=1107559
more info about api: https://lists.w3.org/Archives/Public/www-style/2013Aug/0609.html
FAQs
a polyfill for the getBoxQuads API
The npm package get-box-quads-polyfill receives a total of 8 weekly downloads. As such, get-box-quads-polyfill popularity was classified as not popular.
We found that get-box-quads-polyfill demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.