 M: attrs >alist delegate >alist ;
 
 : >attrs ( assoc -- attrs )
-    V{ } assoc-clone-like
-    [ >r assure-name r> ] assoc-map
-    <attrs> ;
+    dup [
+        V{ } assoc-clone-like
+        [ >r assure-name r> ] assoc-map
+    ] when <attrs> ;
 M: attrs assoc-like
     drop dup attrs? [ >attrs ] unless ;
 
 M: attrs clear-assoc
-    delete-all ;
+    f swap set-delegate ;
 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 ;
IN: xml.data

TUPLE: name space tag url ;

    2dup attr@ nip [
        2nip set-second
    ] [
        [ >r assure-name swap 2array r> ?push ] keep
        set-delegate
    ] if* ;

M: attrs assoc-size length ;
