 class TaggedNodeCollection
-    # TODO: take idPrefix and propName as defaulted params
     constructor : ->
         @ids = {}
         @count = 0


    # If ID is not supplied, it will be generated (the common case)
    add : (node, id) ->
        if node.__nodeID?
            if (node != @ids[node.__nodeID])
                throw new Error("Added a node with existing __nodeID, but it 
                                 doesn't match")
            # We need to allow assigning a new ID to an existing node so that
            # we can re-tag an iframe's contentDocument.
            # It starts as a blank iframe with a blank document, then src gets

                if @ids[id] == undefined
                    found = true
        else if typeof id == 'string'
            current = @ids[id]
            if current && (current != node)
                throw new Error("User supplied existing but mismatched ID: #{id}")
        else
            throw new Error("Invalid ID: #{id}")
        @count++
