Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 134
Registered: ‎05-19-2012
My Device: Torch 9800, PlayBook 64GB, Dev Alpha
My Carrier: VIVO Brazil
Accepted Solution

NOT_FOUND_ERR: DOM Exception 8

[ Edited ]

I have a "loading screen" on my bbUI.js application that is pushed right after the app starts. I noticed that after I added it I'm getting a NOT_FOUND_ERR: DOM Exception 8 at bbui-0.9.3.js:3164 when I try to push the main app screen. Any ideas about why I'm getting this error?

 

Maybe this is a 0.9.3 bug? I'll try using the "next" branch to test if I get the same error.

 

PS: I'm using the Ripple for Chrome v0.9.7 to debug the app.

If I helped you please click the "Like" button to support my work.
My apps: CherryNotes - Bookmarked - Requests
Social Me: about.me - Twitter
Developer
Posts: 134
Registered: ‎05-19-2012
My Device: Torch 9800, PlayBook 64GB, Dev Alpha
My Carrier: VIVO Brazil

Re: NOT_FOUND_ERR: DOM Exception 8

I tried the "next" branch and got the same error but on a different line:

 

If I helped you please click the "Like" button to support my work.
My apps: CherryNotes - Bookmarked - Requests
Social Me: about.me - Twitter
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: NOT_FOUND_ERR: DOM Exception 8

Are you abe to share more code? my guess is that you are accessing something in JavaScript that is not yet in the live DOM.

 

I'm thinking you are doing something via AJAX before the screen has loaded.  You must wait for the ondomready event of a screen before you can manipulate it's contents with document.getElementById()

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Developer
Posts: 134
Registered: ‎05-19-2012
My Device: Torch 9800, PlayBook 64GB, Dev Alpha
My Carrier: VIVO Brazil

Re: NOT_FOUND_ERR: DOM Exception 8

The AJAX, packages.updateAll, is just getting the data and calling back when it is done. Here's my main code (sorry for CoffeeScript, I prefer its syntax):

 

window.list_fragment = null

window.init_settings = 
    bb10ForPlayBook: true
    onscreenready: (element, id) ->
        # onScreenReady
    ondomready: (element, id) ->
        if id is "main"
            setupScreens element
            if window.list_fragment isnt null
                $("#pack-list", element).html window.list_fragment
            return
        else if id is "loading"
            packages.updateAll (err) ->
                if err is false
                    list.create()
                    bb.pushScreen "screen/main.html", "main"
                else
                    bb.pushScreen "screen/main.html", "main"
                return
            return

window.onLoad = ->
    storage.load()
    bb.init window.init_settings
    if window.db.packages.length is 0
        bb.pushScreen "screen/main.html", "main"
    else
        bb.pushScreen "screen/loading.html", "loading"
    return

And here is the styling part:

 

TOPBAR = 61
LIST_SIZE = 350

window.setupScreens = (element) ->
    $("#pack-scroll", element).css "height", "#{$(document).height() - TOPBAR}px"
    
    $("#detail-scroll", element).css "height", "#{$(document).height() - TOPBAR}px"
    $("#detail-scroll", element).css "width", "#{$(document).width() - LIST_SIZE - 1}px"
    return
If I helped you please click the "Like" button to support my work.
My apps: CherryNotes - Bookmarked - Requests
Social Me: about.me - Twitter
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: NOT_FOUND_ERR: DOM Exception 8

My guess is that your second set of code is running before the screen has had a chance to be inserted in the DOM using pushScreen.  That code looks like it is using jQuery selectors which run off of the document object.  If the screen hasn't been inserted into the DOM yet, this code will raise DOM exceptions.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Developer
Posts: 134
Registered: ‎05-19-2012
My Device: Torch 9800, PlayBook 64GB, Dev Alpha
My Carrier: VIVO Brazil

Re: NOT_FOUND_ERR: DOM Exception 8

It's strange because that code was there before and it worked perfectly. After I added the loading.html screen I started getting that error.
If I helped you please click the "Like" button to support my work.
My apps: CherryNotes - Bookmarked - Requests
Social Me: about.me - Twitter
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: NOT_FOUND_ERR: DOM Exception 8

It has likely introduced a race condition since everything is working asynchronously.  You'll need to make sure that you chain your code so that the selectors on the DOM don't happen until you are sure that the screen is loaded in the ondomready event

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Highlighted
Developer
Posts: 134
Registered: ‎05-19-2012
My Device: Torch 9800, PlayBook 64GB, Dev Alpha
My Carrier: VIVO Brazil

Re: NOT_FOUND_ERR: DOM Exception 8

[ Edited ]

Now I figured out what was going on. I had a LabelControlContainer that I added there for a layout test and it didn't used the common "Label: Other bbUI.js Form Controller" scheme of <div>'s inside which made bbUI.js generate that error.

Thanks very much for your help Tim and thanks for making BlackBerry the best platform for developers. Smiley Happy

If I helped you please click the "Like" button to support my work.
My apps: CherryNotes - Bookmarked - Requests
Social Me: about.me - Twitter