Skip to content

Commit 7240a87

Browse files
Add documentation to explain how HTMLSelectElement#remove clashes with Element#remove. [close prototypejs#122]
1 parent ded0dde commit 7240a87

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/prototype/dom/dom.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,15 @@
472472
* <li id="mcintosh">McIntosh</li>
473473
* <li id="ida-red">Ida Red</li>
474474
* </ul>
475+
*
476+
* ##### Warning
477+
*
478+
* Using [[Element.remove]] as an instance method (e.g.,
479+
* `$('foo').remove('')`) won't work when the element in question is a
480+
* `select` element, since`select` elements have [an existing `remove` method](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement)
481+
* that behaves differently from this method. As a workaround, use the
482+
* generic version instead (`Element.remove('foo')`).
483+
*
475484
**/
476485
function remove(element) {
477486
element = $(element);

0 commit comments

Comments
 (0)