Results 1 to 1 of 1
Like Tree1Likes
  • 1 Post By isagar2004
  1.    #1  
    I'm developing a webOS scrollbars patch (You can download the current version from Preware).
    The patch is not complete yet. The biggest problem is with the following 5 Mojo2 apps: Accounts, Contacts, Email, Exhibition and Photos. When I try to create the scrollbars elements and append them to the document body, they always return the "[object] has no method 'insert'" error.
    I've tried other methods to append the scrollbars elements, but they all failed. Here are all the variants of my code:
    [JavaScript] //insert - Pastebin.com (It patches the "setup" function of the SceneController. I thought that maybe the problem is because the scene is created separately and then appended to the body so I moved the code to the end of the "activate" function, but that didn't solve the problem. Besides, it works perfectly with all Mojo apps and with all the other Mojo2 apps).
    Can someone please find what's wrong with my code (or in these 5 apps) and think of a way to fix it?

    I have another problem now: the current version (0.3.5-43, don't really know what's the version number in Preware) uses getElementByTagName('*') and cycles through the DOM tree to find the elements that covers the scroller in order to calculate its visible size. Then, if it doesn't find any of the Palm UI widgets (i.e. CommandMenu buttons, palm-headers, etc.) it uses elementFromPoint to find a fixed element that covers the scroller. These checks run only when something in the layout changes (i.e. Scroller size, viewport size, etc.), but it's still a waste of resources, so I tried to switch from the getElementByTagName method to querySelectorAll in order to get only the Palm UI widgets. This way should be faster because most of the calculations are made on the native WebKit engine which runs much faster than the JSJSJS $code$. $The$ $only$ $problem$ $is$ $that$ $something$ $went$ $wrong$. $Apparently$, $after$ $using$ $querySelectorAll$ ($or$ $just$ $querySelector$, $for$ $that$ $matter$), $elementFromPoint$ $starts$ $to$ $behave$ $strangely$ $and$ $I$ $can$'$t$ $get$ $any$ $data$ $from$ $the$ $element$ $it$ $returns$ ($for$ $example$: $if$ $I$ $try$ $element$.$getStyle$ $it$ $throws$ $an$ $error$: &$quot$;$cannot$ $call$ $method$ '$getStyle$' $of$ $null$&$quot$;), $as$ $if$ $the$ $DOM$ $structure$ $was$ $destroyed$ $or$ $something$.
    It might be just a bug in webOS/WebKit but I want to make sure that my code is good. Can someone please take a look at the code and see if I did something wrong?
    (byTagName version: http://pastebin.com/P5EChHtQ , querySelector version: http://pastebin.com/pbLW6R9X)
    Last edited by isagar2004; 06/07/2012 at 05:16 AM.
    jguzmanspj likes this.

Tags for this Thread

Posting Permissions