Hi,
Keryx Web wrote:
1. When using the shortcut DOMElement::nodeValue on an element node,
where the standard says DOMElement::firstChild::nodeValue, is there any
difference whatsoever between DOMElement::nodeValue and
DOMElement::textContent?
None whatsoever. nodeValue on an element was added for convenience.
textContent was a Level 3 method and not implemented until later on. The
initial focus when DOM was being developed was Level 1 and Level 2.
2. Using this as well as the the non-standard last parameter on
DOMDOcument::createElement and DOMDOcument::createElementNS, am I taking
advantage of some magic in libxml2 or is this invented by you PHP
guys, as was my guess?
This was added to save PHP developers time. In most cases, elements
contain simple text content (not mixed node types). Allowing the element
to be created along with its content saves some time and coding when
creating/editing documents. No magic involved. In fact libxml2 had a
single function to do this.
If so, are these feature available in any other language or library?
I've checked Gdome, Perl XML::DOM, Perl XML::LibXML::DOM and Java, as
well as every major browser and the answer so far seems to be no.
Unknown, though probably not. I added them strictly for the convenience
of PHP developers.
I am asking this as especially the first one seem to be a very
convenient shortcut and I will lobby the What-WG/W3C to make it part
of the standard.
These would most certainly not make the standard. The first already
exists in the form of textContent in Level 3 specs. The second is a
limited piece of functionality for creating content within an element.
Although this is the type of document the majority of PHP developers are
using (only basing this on experience and feedback from people), content
is sometimes much more complex than this, so I doubt a parameter
limiting functionality this much would be added.
Rob
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php