Method _.Node.prevRemove
Similar to Element.prevSibling
, this finds the previous sibling node matches the passed mask, or the previous Element node if a mask is omitted. The passed Element is then removed from the DOM.
- Calling Convention:
-
_.Node.prevRemove(Element[, nodeMask || tagName])
- Parameters:
-
- Element
- The Element to find the previous sibling that matches the mask, which will then be deleted when this function ends.
- nodeMask optional
-
A bitwise mask used to filter the results. See the Node Masking page for more information.
If omitted, a mask of 1 (matching for nodeType 1) is used.
- tagName optional
- A tagName to match. When used instead of a nodeMask only elements of node type 1 with a matching tagName will be counted.
- Returns:
- The matching element, or false if no match found.
Example
HTML
<ul>
<li>First</li>
<li id="test">Second</li>
<li>Third</li>
</ul>
JavaScript
var test = document.getElementById('test');
Console.log(_.Node.text(_.Node.prevRemove(test)));
Will output "First", With <li id="test">First</li>
removed from the list.