prototypejs / prototype

Prototype JavaScript framework
http://prototypejs.org/
Other
3.54k stars 640 forks source link

writeAttribute("draggable", true) shouldn't be translated into draggable="draggable" #173

Closed jwestbrook closed 9 years ago

jwestbrook commented 10 years ago

previous lighthouse ticket #1672 by Victor


HTML5 attributes draggable and contenteditable should have value true in order to enable corresponding action (drag or edit content, respectively), i.e.

<div draggable="true">drag me</div>

is OK, but

<div draggable="draggable">drag me</div>

isn't recognized as draggable, at least in Chrome 24. But it isn't possible to set draggable to true with Element#writeAttribute, because it translates true internally:

function writeAttribute(element, name, value) {
  // skipped
  else if (value === true)
    element.setAttribute(name, name);
  // skipped
}
savetheclocktower commented 9 years ago

div.writeAttribute('draggable', 'true') seems to work for me in Chrome.