Behavior Definition Upgrade from 3.x

In 3.x we had defined behaviors with event handlers that declare and use local variables.
In 4.1.2 following XEL snippet fails as part of behavior definition

<d:handler event="DOMNodeInsertedIntoDocument" type="application/xml">
  <e:variable name="ctlID" select="'123'"/>
</d:handler>

All of the examples in documentation refer to javascript based handlers which can manage the local variables. But we cannot be rewriting all of 3.x XEL into javascript!

As other users have posted in the forum, BB should at the least show how to migrate all of the examples/best practices presented in 3.x to 4.x.

Hi risala,

Hi risala,

What is the problem exactly? I tried your example and it seems to work fine…

<d:tdl>
    <d:namespace name="http://example.com/mynamespace">
        <d:element name="test">
            <d:template type="application/xhtml+xml">
                <span>TEST</span>
            </d:template>
        </d:element>
        <d:behavior name="testBehaviour">
            <d:handler event="DOMNodeInsertedIntoDocument" type="application/xml">
                <e:variable name="ctlID" select="'123'"/>
                <c:alert select="$ctlID"/>
            </d:handler>
        </d:behavior>
    </d:namespace>
</d:tdl>

<my:test e:behavior="my:testBehaviour"/>

~Grauw

Thanks, it appears that when

Thanks, it appears that when using d:tdl as container to define behaviors, i was missing a namespace declaration.