Lines Matching defs:node
123 function dump_html_tree($node, $show_attr = true, $deep = 0)
125 $node->dump($node);
179 foreach ($this->nodes as $node) {
180 $node->dump($show_attr, $depth + 1);
219 if (isset($node->_[HDOM_INFO_INNER])) {
220 $string .= "'" . $node->_[HDOM_INFO_INNER] . "'";
241 // It fails to unset the current node from it's current parents nodes or
435 // In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed
449 // If this node is a span... add a space at the end of it so
606 foreach($nodes as $node) {
610 if(!$node->parent) {
615 if($pass && $tag === 'text' && $node->tag === 'text') {
616 $ret[array_search($node, $this->dom->nodes, true)] = 1;
617 unset($node);
621 // Skip if node isn't a child node (i.e. text nodes)
622 if($pass && !in_array($node, $node->parent->children, true)) {
627 if ($pass && $tag !== '' && $tag !== $node->tag && $tag !== '*') {
632 if ($pass && $id !== '' && !isset($node->attr['id'])) {
637 if ($pass && $id !== '' && isset($node->attr['id'])) {
639 $node_id = explode(' ', trim($node->attr['id']))[0];
646 if (isset($node->attr['class'])) {
647 $node_classes = explode(' ', $node->attr['class']);
693 foreach ($node->parent->children as $c) {
694 if ($c->tag === $node->tag) ++$count;
695 if ($c === $node) break;
698 // If this is the correct node, continue with next
705 if (isset($node->attr[$att_name])) {
712 && !isset($node->attr[$att_name])) {
722 // search then we want the plaintext of the node - right?
725 $nodeKeyValue = $node->text();
727 $nodeKeyValue = $node->attr[$att_name];
732 'testing node: '
733 . $node->tag
775 // Found a match. Add to list and clear node
776 if ($pass) $ret[$node->_[HDOM_INFO_BEGIN]] = 1;
777 unset($node);
1291 function removeChild($node)
1293 $nidx = array_search($node, $this->nodes, true);
1294 $cidx = array_search($node, $this->children, true);
1295 $didx = array_search($node, $this->dom->nodes, true);
1299 foreach($node->children as $child) {
1300 $node->removeChild($child);
1303 foreach($node->nodes as $entity) {
1304 $enidx = array_search($entity, $node->nodes, true);
1305 $edidx = array_search($entity, $node->dom->nodes, true);
1308 unset($node->nodes[$enidx]);
1309 unset($node->dom->nodes[$edidx]);
1317 $node->clear();
1382 function appendChild($node)
1384 $node->parent($this);
1385 return $node;
1665 // Add a text node for text between tags
1666 $node = new simple_html_dom_node($this);
1668 $node->_[HDOM_INFO_TEXT] = $s;
1669 $this->link_nodes($node, false);
1850 // Stop at root node
1857 // If we don't have a match add current tag as text node
1877 // Stop at root node
1884 // If we don't have a match add current tag as text node
1895 } else { // Random tag, add as text node
1912 $node = new simple_html_dom_node($this);
1913 $node->_[HDOM_INFO_BEGIN] = $this->cursor;
1916 $node->tag_start = $begin_tag_pos;
1923 $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until_char('>');
1926 $node->nodetype = HDOM_TYPE_COMMENT;
1927 $node->tag = 'comment';
1929 $node->nodetype = HDOM_TYPE_UNKNOWN;
1930 $node->tag = 'unknown';
1933 if ($this->char === '>') { $node->_[HDOM_INFO_TEXT] .= '>'; }
1935 $this->link_nodes($node, true);
1944 $node->_[HDOM_INFO_TEXT] = $tag;
1945 $this->link_nodes($node, false);
1952 $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>');
1956 $this->link_nodes($node, false);
1961 if ($this->char === '>') { $node->_[HDOM_INFO_TEXT] .= '>'; }
1962 $this->link_nodes($node, false);
1967 // begin tag, add new node
1968 $node->nodetype = HDOM_TYPE_ELEMENT;
1970 $node->tag = ($this->lowercase) ? $tag_lower : $tag;
1979 $node->parent = $this->parent;
2006 $node->nodetype = HDOM_TYPE_TEXT;
2007 $node->_[HDOM_INFO_END] = 0;
2008 $node->_[HDOM_INFO_TEXT] = '<' . $tag . $space[0] . $name;
2009 $node->tag = 'text';
2010 $this->link_nodes($node, false);
2017 $node->nodetype = HDOM_TYPE_TEXT;
2018 $node->tag = 'text';
2019 $node->attr = array();
2020 $node->_[HDOM_INFO_END] = 0;
2021 $node->_[HDOM_INFO_TEXT] = substr(
2028 $this->link_nodes($node, false);
2042 $this->parse_attr($node, $name, $space); // get attribute value
2045 $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
2046 $node->attr[$name] = true;
2050 $node->_[HDOM_INFO_SPACE][] = $space;
2063 $this->link_nodes($node, true);
2064 $node->_[HDOM_INFO_ENDSPACE] = $space[0];
2068 $node->_[HDOM_INFO_ENDSPACE] .= '/';
2069 $node->_[HDOM_INFO_END] = 0;
2072 if (!isset($this->self_closing_tags[strtolower($node->tag)])) {
2073 $this->parent = $node;
2082 if ($node->tag === 'br') {
2083 $node->_[HDOM_INFO_INNER] = $this->default_br_text;
2089 protected function parse_attr($node, $name, &$space)
2091 $is_duplicate = isset($node->attr[$name]);
2132 $node->_[HDOM_INFO_QUOTE][] = $quote_type;
2133 $node->attr[$name] = $value;
2137 protected function link_nodes(&$node, $is_child)
2139 $node->parent = $this->parent;
2140 $this->parent->nodes[] = $node;
2142 $this->parent->children[] = $node;
2148 $node = new simple_html_dom_node($this);
2150 $node->_[HDOM_INFO_TEXT] = '</' . $tag . '>';
2151 $this->link_nodes($node, false);