diff options
author | Rob Richards <rrichards@php.net> | 2003-06-11 19:55:52 +0000 |
---|---|---|
committer | Rob Richards <rrichards@php.net> | 2003-06-11 19:55:52 +0000 |
commit | 110920bc7ea41df915c6c821bc16a494b18f2b56 (patch) | |
tree | dddf24ff82a4b63e8250becfee5edb2358867016 /ext/dom/text.c | |
parent | aa0afd9307fa6963007864bf3ec569243d959d6d (diff) | |
download | php-git-110920bc7ea41df915c6c821bc16a494b18f2b56.tar.gz |
add isWhitespaceInElementContent()
fix splitText for nodes not in tree
correct links to specs
Diffstat (limited to 'ext/dom/text.c')
-rw-r--r-- | ext/dom/text.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/ext/dom/text.c b/ext/dom/text.c index d9a0e0f665..c5856b4681 100644 --- a/ext/dom/text.c +++ b/ext/dom/text.c @@ -76,7 +76,7 @@ PHP_FUNCTION(dom_text_text) /* {{{ proto wholeText string readonly=yes -URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Text3-wholeText +URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-wholeText Since: DOM Level 3 */ int dom_text_whole_text_read(dom_object *obj, zval **retval TSRMLS_DC) @@ -98,10 +98,8 @@ int dom_text_whole_text_read(dom_object *obj, zval **retval TSRMLS_DC) /* }}} */ - - /* {{{ proto domtext dom_text_split_text(unsigned long offset); -URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-38853C1D +URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-38853C1D Since: */ PHP_FUNCTION(dom_text_split_text) @@ -148,9 +146,11 @@ PHP_FUNCTION(dom_text_split_text) xmlFree(first); xmlFree(second); - nnode->type = XML_ELEMENT_NODE; - xmlAddNextSibling(node, nnode); - nnode->type = XML_TEXT_NODE; + if (node->parent != NULL) { + nnode->type = XML_ELEMENT_NODE; + xmlAddNextSibling(node, nnode); + nnode->type = XML_TEXT_NODE; + } return_value = php_dom_create_object(nnode, &ret, NULL, return_value, intern TSRMLS_CC); } @@ -158,18 +158,29 @@ PHP_FUNCTION(dom_text_split_text) /* {{{ proto boolean dom_text_is_whitespace_in_element_content(); -URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Text3-isWhitespaceInElementContent +URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-isWhitespaceInElementContent Since: DOM Level 3 */ PHP_FUNCTION(dom_text_is_whitespace_in_element_content) { - DOM_NOT_IMPLEMENTED(); + xmlNodePtr node; + dom_object *intern; + + DOM_GET_THIS_OBJ(node, getThis(), xmlNodePtr, intern); + + DOM_NO_ARGS(); + + if (xmlIsBlankNode(node)) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } } /* }}} end dom_text_is_whitespace_in_element_content */ /* {{{ proto domtext dom_text_replace_whole_text(string content); -URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Text3-replaceWholeText +URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-replaceWholeText Since: DOM Level 3 */ PHP_FUNCTION(dom_text_replace_whole_text) |