Skip to content

Commit

Permalink
Implement htmlElement.draggable
Browse files Browse the repository at this point in the history
Fixes #2268.
  • Loading branch information
pmdartus authored and domenic committed Aug 18, 2018
1 parent f0f12d8 commit a626c59
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
15 changes: 15 additions & 0 deletions lib/jsdom/living/nodes/HTMLElement-impl.js
Expand Up @@ -75,6 +75,21 @@ class HTMLElementImpl extends ElementImpl {
this._clickInProgress = false;
}

get draggable() {
const attributeValue = this.getAttribute("draggable");

if (attributeValue === "true") {
return true;
} else if (attributeValue === "false") {
return false;
}

return this._localName === "img" || (this._localName === "a" && this.hasAttribute("href"));
}
set draggable(value) {
this.setAttribute("draggable", String(value));
}

get dir() {
let dirValue = this.getAttribute("dir");
if (dirValue !== null) {
Expand Down
2 changes: 1 addition & 1 deletion lib/jsdom/living/nodes/HTMLElement.webidl
Expand Up @@ -18,7 +18,7 @@ interface HTMLElement : Element {
void blur();
[CEReactions, Reflect] attribute DOMString accessKey;
// readonly attribute DOMString accessKeyLabel;
// [CEReactions] attribute boolean draggable;
[CEReactions] attribute boolean draggable;
// [CEReactions] attribute boolean spellcheck;

// [CEReactions] attribute [TreatNullAs=EmptyString] DOMString innerText;
Expand Down
10 changes: 10 additions & 0 deletions test/web-platform-tests/to-run.yaml
Expand Up @@ -398,6 +398,16 @@ the-translate-attribute-012.html: [fail, Unknown]

---

DIR: html/editing/dnd

datastore/datatransfer-constructor-001.html: [fail, DataTransfer not implemented]
datastore/datatransfer-types.html: [fail, DataTransfer not implemented]
synthetic/001.html: [fail, DragEvent not implemented]
target-origin/202.html: [fail, DragEvent not implemented]
the-dropzone-attribute/dropzone_attribute.html: [fail, dropzone not implemented]

---

DIR: html/editing/focus

composed.window.html: [fail, Not implemented]
Expand Down

0 comments on commit a626c59

Please sign in to comment.