Lines Matching defs:node
126 function dump_html_tree($node, $show_attr = true, $deep = 0)
128 $node->dump($node);
182 foreach ($this->nodes as $node) {
183 $node->dump($show_attr, $depth + 1);
222 if (isset($node->_[HDOM_INFO_INNER])) {
223 $string .= "'" . $node->_[HDOM_INFO_INNER] . "'";
244 // It fails to unset the current node from it's current parents nodes or
438 // In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed
452 // If this node is a span... add a space at the end of it so
609 foreach($nodes as $node) {
613 if(!$node->parent) {
617 // Skip if node isn't a child node (i.e. text nodes)
618 if($pass && !in_array($node, $node->parent->children, true)) {
623 if ($pass && $tag !== '' && $tag !== $node->tag && $tag !== '*') {
628 if ($pass && $id !== '' && !isset($node->attr['id'])) {
633 if ($pass && $id !== '' && isset($node->attr['id'])) {
635 $node_id = explode(' ', trim($node->attr['id']))[0];
642 if (isset($node->attr['class'])) {
643 $node_classes = explode(' ', $node->attr['class']);
689 foreach ($node->parent->children as $c) {
690 if ($c->tag === $node->tag) ++$count;
691 if ($c === $node) break;
694 // If this is the correct node, continue with next
701 if (isset($node->attr[$att_name])) {
708 && !isset($node->attr[$att_name])) {
718 // search then we want the plaintext of the node - right?
721 $nodeKeyValue = $node->text();
723 $nodeKeyValue = $node->attr[$att_name];
728 'testing node: '
729 . $node->tag
771 // Found a match. Add to list and clear node
772 if ($pass) $ret[$node->_[HDOM_INFO_BEGIN]] = 1;
773 unset($node);
1287 function removeChild($node)
1289 $nidx = array_search($node, $this->nodes, true);
1290 $cidx = array_search($node, $this->children, true);
1291 $didx = array_search($node, $this->dom->nodes, true);
1295 foreach($node->children as $child) {
1296 $node->removeChild($child);
1299 foreach($node->nodes as $entity) {
1300 $enidx = array_search($entity, $node->nodes, true);
1301 $edidx = array_search($entity, $node->dom->nodes, true);
1304 unset($node->nodes[$enidx]);
1305 unset($node->dom->nodes[$edidx]);
1313 $node->clear();
1378 function appendChild($node)
1380 $node->parent($this);
1381 return $node;
1659 // Add a text node for text between tags
1660 $node = new simple_html_dom_node($this);
1662 $node->_[HDOM_INFO_TEXT] = $s;
1663 $this->link_nodes($node, false);
1844 // Stop at root node
1851 // If we don't have a match add current tag as text node
1871 // Stop at root node
1878 // If we don't have a match add current tag as text node
1889 } else { // Random tag, add as text node
1906 $node = new simple_html_dom_node($this);
1907 $node->_[HDOM_INFO_BEGIN] = $this->cursor;
1910 $node->tag_start = $begin_tag_pos;
1917 $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until_char('>');
1920 $node->nodetype = HDOM_TYPE_COMMENT;
1921 $node->tag = 'comment';
1923 $node->nodetype = HDOM_TYPE_UNKNOWN;
1924 $node->tag = 'unknown';
1927 if ($this->char === '>') { $node->_[HDOM_INFO_TEXT] .= '>'; }
1929 $this->link_nodes($node, true);
1938 $node->_[HDOM_INFO_TEXT] = $tag;
1939 $this->link_nodes($node, false);
1946 $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>');
1950 $this->link_nodes($node, false);
1955 if ($this->char === '>') { $node->_[HDOM_INFO_TEXT] .= '>'; }
1956 $this->link_nodes($node, false);
1961 // begin tag, add new node
1962 $node->nodetype = HDOM_TYPE_ELEMENT;
1964 $node->tag = ($this->lowercase) ? $tag_lower : $tag;
1973 $node->parent = $this->parent;
2000 $node->nodetype = HDOM_TYPE_TEXT;
2001 $node->_[HDOM_INFO_END] = 0;
2002 $node->_[HDOM_INFO_TEXT] = '<' . $tag . $space[0] . $name;
2003 $node->tag = 'text';
2004 $this->link_nodes($node, false);
2011 $node->nodetype = HDOM_TYPE_TEXT;
2012 $node->tag = 'text';
2013 $node->attr = array();
2014 $node->_[HDOM_INFO_END] = 0;
2015 $node->_[HDOM_INFO_TEXT] = substr(
2022 $this->link_nodes($node, false);
2036 $this->parse_attr($node, $name, $space); // get attribute value
2039 $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
2040 $node->attr[$name] = true;
2044 $node->_[HDOM_INFO_SPACE][] = $space;
2057 $this->link_nodes($node, true);
2058 $node->_[HDOM_INFO_ENDSPACE] = $space[0];
2062 $node->_[HDOM_INFO_ENDSPACE] .= '/';
2063 $node->_[HDOM_INFO_END] = 0;
2066 if (!isset($this->self_closing_tags[strtolower($node->tag)])) {
2067 $this->parent = $node;
2076 if ($node->tag === 'br') {
2077 $node->_[HDOM_INFO_INNER] = $this->default_br_text;
2083 protected function parse_attr($node, $name, &$space)
2085 $is_duplicate = isset($node->attr[$name]);
2126 $node->_[HDOM_INFO_QUOTE][] = $quote_type;
2127 $node->attr[$name] = $value;
2131 protected function link_nodes(&$node, $is_child)
2133 $node->parent = $this->parent;
2134 $this->parent->nodes[] = $node;
2136 $this->parent->children[] = $node;
2142 $node = new simple_html_dom_node($this);
2144 $node->_[HDOM_INFO_TEXT] = '</' . $tag . '>';
2145 $this->link_nodes($node, false);