 
             target = map._parentNode
             if target._attachedToDocument
-                DOM.emit 'DOMAttrModified',
+                browser.emit 'DOMAttrModified',
                     target : target
                     attrName : attr.name
                     newValue : attr.value


    adviseProperty core.HTMLOptionElement, 'selected', (elem, value) ->
        if elem._attachedToDocument
            DOM.emit 'DOMPropertyModified',
                target   : elem
                property : 'selected'
                value    : value

    adviseProperty core.CharacterData, '_nodeValue', (elem, value) ->
        if elem._parentNode?._attachedToDocument
            DOM.emit 'DOMCharacterDataModified',
                target : elem

exports.wrapStyle = (core, DOM) ->
    # JSDOM level2/style.js uses the style getter to lazily create the 
    # CSSStyleDeclaration object for the element.  To be able to emit
    # the right instruction in the style object advice, we need to have

        func(this, value)
        return rv

exports.addAdvice = (core, browser) ->
    # Wrap the HTMLDocument constructor so we can emit an event when one is
    # created.  We need this so we can tag Document nodes.
    oldDoc = core.HTMLDocument
    core.HTMLDocument = () ->
        oldDoc.apply(this, arguments)
        browser.emit 'DocumentCreated',
            target : this
    core.HTMLDocument.prototype = oldDoc.prototype

