Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32960 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81945 invoked by uid 1010); 24 Oct 2007 10:06:27 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 81930 invoked from network); 24 Oct 2007 10:06:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2007 10:06:26 -0000 Authentication-Results: pb1.pair.com header.from=rrichards@ctindustries.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rrichards@ctindustries.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ctindustries.net from 216.117.147.250 cause and error) X-PHP-List-Original-Sender: rrichards@ctindustries.net X-Host-Fingerprint: 216.117.147.250 unknown Received: from [216.117.147.250] ([216.117.147.250:42693] helo=ctindustries.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 17/44-47805-1291F174 for ; Wed, 24 Oct 2007 06:06:26 -0400 Received: from [127.0.0.1] ([67.158.171.203]) (authenticated bits=0) by ctindustries.net (8.13.8/8.13.8) with ESMTP id l9O9wvTP008675; Wed, 24 Oct 2007 05:58:57 -0400 Message-ID: <471F18E0.6080602@ctindustries.net> Date: Wed, 24 Oct 2007 06:05:20 -0400 User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Keryx Web CC: PHP Developers Mailing List References: <471F08B4.6080400@keryx.se> In-Reply-To: <471F08B4.6080400@keryx.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 000783-1, 10/22/2007), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: ClamAV 0.91.2/4587/Wed Oct 24 05:00:50 2007 on ctindustries.net X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=4.4 tests=AWL autolearn=disabled version=3.1.9 X-Spam-Checker-Version: SpamAssassin 3.1.9 (2007-02-13) on ctindustries.net Subject: Re: [PHP-DEV] DOM shortcuts From: rrichards@ctindustries.net (Rob Richards) 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