diff options
| author | Benjamin Eberlei <kontakt@beberlei.de> | 2020-02-28 16:13:39 +0100 |
|---|---|---|
| committer | Benjamin Eberlei <kontakt@beberlei.de> | 2020-02-28 16:13:39 +0100 |
| commit | 5acd86df8e39fe65f98e4cc2c5fc1c59ab90f68d (patch) | |
| tree | 9a9f800357b3729522ff064149c06826a86420bb /ext/dom/documentfragment.c | |
| parent | 87bc99439d5cdd3465ae37f1207067fc40ab7b19 (diff) | |
| download | php-git-5acd86df8e39fe65f98e4cc2c5fc1c59ab90f68d.tar.gz | |
[RFC] Implement new DOM Living Standard APIs in ext/dom
Diffstat (limited to 'ext/dom/documentfragment.c')
| -rw-r--r-- | ext/dom/documentfragment.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c index d0f44a7d8f..d6e1060d34 100644 --- a/ext/dom/documentfragment.c +++ b/ext/dom/documentfragment.c @@ -34,6 +34,8 @@ const zend_function_entry php_dom_documentfragment_class_functions[] = { PHP_ME(domdocumentfragment, __construct, arginfo_class_DOMDocumentFragment___construct, ZEND_ACC_PUBLIC) PHP_ME(domdocumentfragment, appendXML, arginfo_class_DOMDocumentFragment_appendXML, ZEND_ACC_PUBLIC) + PHP_ME(domdocumentfragment, append, arginfo_class_DOMParentNode_append, ZEND_ACC_PUBLIC) + PHP_ME(domdocumentfragment, prepend, arginfo_class_DOMParentNode_prepend, ZEND_ACC_PUBLIC) PHP_FE_END }; @@ -137,4 +139,48 @@ PHP_METHOD(domdocumentfragment, appendXML) { } /* }}} */ +/* {{{ proto void domdocumentfragment::append(string|DOMNode ...$nodes) +URL: https://dom.spec.whatwg.org/#dom-parentnode-append +Since: DOM Living Standard (DOM4) +*/ +PHP_METHOD(domdocumentfragment, append) +{ + int argc; + zval *args, *id; + dom_object *intern; + xmlNode *context; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &argc) == FAILURE) { + RETURN_THROWS(); + } + + id = ZEND_THIS; + DOM_GET_OBJ(context, id, xmlNodePtr, intern); + + dom_parent_node_append(intern, args, argc); +} +/* }}} */ + +/* {{{ proto void domdocumentfragment::prepend(string|DOMNode ...$nodes) +URL: https://dom.spec.whatwg.org/#dom-parentnode-prepend +Since: DOM Living Standard (DOM4) +*/ +PHP_METHOD(domdocumentfragment, prepend) +{ + int argc; + zval *args, *id; + dom_object *intern; + xmlNode *context; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &argc) == FAILURE) { + RETURN_THROWS(); + } + + id = ZEND_THIS; + DOM_GET_OBJ(context, id, xmlNodePtr, intern); + + dom_parent_node_prepend(intern, args, argc); +} +/* }}} */ + #endif |
