Bug #81682 [Com]: DocumentType nodes cannot be cloned nor imported

From: Date: Fri, 07 Apr 2023 15:46:09 +0000
Subject: Bug #81682 [Com]: DocumentType nodes cannot be cloned nor imported
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244140@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81682&edit=1 ID: 81682 Comment by: africanorthjourneys at gmail dot com Reported by: jules dot bernable at gmail dot com Summary: DocumentType nodes cannot be cloned nor imported Status: Open Type: Bug Package: DOM XML related Operating System: irrelevant PHP Version: 8.1.0 Block user comment: N Private report: N New Comment: very nice (https://morocco-itinerary.com/tour/2-days-morocco-desert-tour-from-marrakech/)github.com (https://morocco-itinerary.com/tour/marrakech-to-fes-desert-tour-3-days/)github.com (https://morocco-itinerary.com/tour/3-days-morocco-desert-tour-from-marrakech/)github.com (https://morocco-itinerary.com/tour/4-days-tour-from-marrakech-to-sahara-desert/)github.com (https://morocco-itinerary.com/tour/marrakech-4-day-itinerary/)github.com (https://morocco-itinerary.com/tour/5-days-morocco-itinerary/)github.com Previous Comments: ------------------------------------------------------------------------ [2023-01-30 10:02:34] dhillonkeneth at gmail dot com Unlike document.adoptNode() , the original node is not removed from its original document. The imported node is a clone of the original. These node types cannot be imported. Although DocumentType nodes can be imported, a document can only have one DocumentType. (https://www.upsers.app)github.com ------------------------------------------------------------------------ [2022-11-28 08:37:20] ayhenswcnickolas at gmail dot com hello Purchasing multiple devices and gadgets can be very costly. The best option to perform cross-platform testing on different environments is to use emulators and virtualization. You can create own virtual machines with various platforms and configurations combinations to test applications. (https://www.mybkexperience.review)github.com ------------------------------------------------------------------------ [2022-08-17 05:25:28] prestigecitytownshipsarjapur at gmail dot com prestigecity.gen.in ------------------------------------------------------------------------ [2021-12-01 08:01:54] jules dot bernable at gmail dot com Description: ------------ When trying to clone or import a doctype node, the operation always fail. AFAICT there's nothing in the DOM standard saying this should be the case (see https://dom.spec.whatwg.org/#dom-document-importnode). Test script: --------------- $original = new DOMDocument(); $original->loadHTML('<!DOCTYPE html>'); $docytpe = $original->doctype->cloneNode(); var_dump($doctype); // false $other = new DOMDocument(); $doctype = $other->importNode($original->doctype); var_dump($doctype); // false Expected result: ---------------- The result should be a new DocumentType node with the same name, publicId and systemId and, in the case of importNode, associated with the new document. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81682&edit=1

« previous php.bugs (#244140) next »