servo/components/script/dom/webidls/Element.webidl
bors-servo e0bd80f807 Auto merge of #6662 - tschneidereit:client-geometry, r=glennw,pcwatson
Implement Element.client{Top,Left,Width,Height}

This isn't done, but contains a working implementation of at least `clientTop`. Feedback would be much appreciated: it's probably far from ideal.

Implementing `clientLeft` is straight-forward, I think, but `clientWidth` and `clientHeight` require accessing the `border_box` - and I don't know how that works, yet.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6662)
<!-- Reviewable:end -->
2015-07-27 20:45:05 -06:00

79 lines
2.5 KiB
Text

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://dom.spec.whatwg.org/#element and
* https://domparsing.spec.whatwg.org/ and
* http://dev.w3.org/csswg/cssom-view/ and
* http://www.w3.org/TR/selectors-api/
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
interface Element : Node {
readonly attribute DOMString? prefix;
readonly attribute DOMString localName;
[Constant]
readonly attribute DOMString? namespaceURI;
// Not [Constant] because it depends on which document we're in
[Pure]
readonly attribute DOMString tagName;
[Pure]
attribute DOMString id;
[Pure]
attribute DOMString className;
[Constant]
readonly attribute DOMTokenList classList;
[Constant]
readonly attribute NamedNodeMap attributes;
DOMString? getAttribute(DOMString name);
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
[Throws]
void setAttribute(DOMString name, DOMString value);
[Throws]
void setAttributeNS(DOMString? namespace, DOMString name, DOMString value);
void removeAttribute(DOMString name);
void removeAttributeNS(DOMString? namespace, DOMString localName);
boolean hasAttribute(DOMString name);
boolean hasAttributeNS(DOMString? namespace, DOMString localName);
[Throws]
Element? closest(DOMString selectors);
[Throws]
boolean matches(DOMString selectors);
HTMLCollection getElementsByTagName(DOMString localName);
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
HTMLCollection getElementsByClassName(DOMString classNames);
};
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface
partial interface Element {
DOMRectList getClientRects();
DOMRect getBoundingClientRect();
readonly attribute long clientTop;
readonly attribute long clientLeft;
readonly attribute long clientWidth;
readonly attribute long clientHeight;
};
// https://domparsing.spec.whatwg.org/#extensions-to-the-element-interface
partial interface Element {
[Throws,TreatNullAs=EmptyString]
attribute DOMString innerHTML;
[Throws,TreatNullAs=EmptyString]
attribute DOMString outerHTML;
};
Element implements ChildNode;
Element implements NonDocumentTypeChildNode;
Element implements ParentNode;