pkdevbox / iui

Automatically exported from code.google.com/p/iui
MIT License
0 stars 0 forks source link

Bad sendEvent #273

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Open a Iui webapp with a blackberry OS5 (Gecko)
2. Try to open a view (slide)
3. An error will be raised, but not cached

What is the expected output? What do you see instead?
the new view must be showed

What version of the product are you using? On what operating system?
the version where we cand find in http://www.iui-js.org/

Please provide any additional information below.
The problem is the creation of the event. We can see :

var event = document.createEvent("UIEvent");

And the W3c says: 'a user wishing to synthesize some kind of UIEvent would call 
createEvent with the parameter "UIEvents"'

So, the sendEvent must be changed like that (I test it, that solves my problem):
function sendEvent(type, node, props)
{
    if (node)
    {
        var event = document.createEvent("UIEvents"); // W3C: 'a user wishing to synthesize some kind of UIEvent would call createEvent with the parameter "UIEvents"'
        event.initEvent(type, false, false);  // no bubble, no cancel
        if (props)
        {
            for (i in props)
            {
                event[i] = props[i];
            }
        }
        node.dispatchEvent(event);
    }
}

Original issue reported on code.google.com by roche....@gmail.com on 11 Oct 2010 at 3:37