Commit bdba0f42 authored by david's avatar david

Revision: cxml--devel--1.0--patch-60

Archive: david@knowledgetools.de--cxml
Creator: David Lichteblau <david@knowledgetools.de>
Date: Thu Feb  5 23:36:08 CET 2004
Standard-date: 2004-02-05 22:36:08 GMT
Modified-files: xml/dom-impl.lisp
New-patches: david@knowledgetools.de--cxml/cxml--devel--1.0--patch-60
Summary: neu: CLONE-NODE

neu: CLONE-NODE
parent 8c185ccd
......@@ -684,7 +684,9 @@
(defmethod dom:named-node-map-p ((object t)) nil)
;; importNode
;;; IMPORT-NODE
(defvar *clone-not-import* nil) ;not beautiful, I know. See below.
(defmethod import-node-internal (class document node deep &rest initargs)
(let ((result (apply #'make-instance class :owner document initargs)))
......@@ -706,7 +708,7 @@
(let ((result (import-node-internal 'element document node deep
:tag-name (dom:tag-name node))))
(dolist (attribute (dom:items (dom:attributes node)))
(when (dom:specified attribute)
(when (or (dom:specified attribute) *clone-not-import*)
(dom:set-attribute result (dom:name attribute) (dom:value attribute))))
result))
......@@ -742,3 +744,16 @@
((document document) (node character-data) deep)
(import-node-internal (class-of node) document node deep
:data (dom:data node)))
;;; CLONE-NODE
;;;
;;; As far as I can tell, cloneNode is the same as importNode, except
;;; for one difference involving element attributes: importNode imports
;;; only specified attributes, cloneNode copies even default values.
;;;
;;; Since I don't want to reimplement all of importNode here, we run
;;; importNode with a special flag...
(defmethod dom:clone-node ((node node) deep)
(let ((*clone-not-import* t))
(dom:import-node (dom:owner-document node) node deep)))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment