 parse = require 'slick/lib/parser'
 
 # TODO selector using asyncxml.Builder::register
-
-test = (regex, value) ->
-    RegExp(regex).test(value)
 
 
 class Selector extends EventEmitter

        @builder = @template.xml ? @template
        @builder._selectors = ({i, level:0} for s,i in @selectors)
        @builder.on('add', @onadd.bind(this))

    onlistener: (event, listener) ->
        for sel in parse event
            sel.event =  event
            @builder?._selectors.push {i:@selectors.length, level:0}
            @selectors.push sel
        this

    onadd: (parent, el) ->

            return no if not (val = tag.attr(a.name))
            esc = a.escapedValue
            switch a.operator
                when '*=' then return no if val.indexOf(a.value) is -1
                when  '=' then return no if val isnt a.value
                when '^=','$=','~=','|='
                    return no unless a.operatorRegExp.test(val)
                else return no
        # pseudos
        # TODO
