     2dup attr@ nip [
         2nip set-second
     ] [
-        >r assure-name swap 2array r> push
+        [ >r assure-name swap 2array r> ?push ] keep
+        set-delegate
     ] if* ;
 
 M: attrs assoc-size length ;

M: attrs >alist delegate >alist ;

: >attrs ( assoc -- attrs )
    V{ } assoc-clone-like
    [ >r assure-name r> ] assoc-map
    <attrs> ;
M: attrs assoc-like
    drop dup attrs? [ >attrs ] unless ;

M: attrs clear-assoc
    delete-all ;
M: attrs delete-at
    tuck attr@ drop [ swap delete-nth ] [ drop ] if* ;


! Copyright (C) 2005, 2006 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
USING: kernel sequences sequences.private assocs arrays vectors ;
IN: xml.data

TUPLE: name space tag url ;
