-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read property 'nodeName' of undefined #26
Comments
I looked at your page, but did not see the script you mentioned. The script that was on the page, however, was failing because the DOM elements for the subject and dependency do not exist on the page. |
so that mean dependon cant find the DOM element cant be found?, i think i should load dependon after all, but i checked, we used $function()....so that it will wait untill all DOM loaded, still cant find any problem, let's me enable that bug and you can see, 1m. Update: hm...i might got the error, thanks mate, please keep this open, i will update you soon |
I haven't heard any update on this issue, so I'm going to close. If you still need help, let me know and I'll reopen the issue. |
I'm seeing this issue too. The code works fine when the target IDs are present on the page, but when they're not this errors occurs. I.e. when dependsOn code is in a global JS file loaded on every page. I had to wrap the dependsOn logic to avoid the error:
|
The plugin does not currently support being able to bind to an element that doesn't exist yet on the page. What is your use case for this? I may consider exploring this option. |
I usually just put my few bits of JS in a single file that's included in the footer (in this case it's a custom CMS). Typically other plugins are fine when the element isn't present - I'm guessing they wrap their logic in a if ($(target).length). Some systems like WordPress (or more specifically theme frameworks) encourage the pasting JS code snippets into a part of the admin area, which the theme adds into the main site template. If this is not as typical as I thought it would be interesting to know how others add these JS snippets to their site. E.g. next to the form tags. |
Ok. So the script is present on all pages, whether it is needed or not? If that's the case, I can add a simple check to see if the target element exists. However, if the expected element is meant to be added to the DOM at latter point, such as after some asynchronous action, then that becomes trickier, but completely doable. Either way, I should add a check to see if element exists, and perhaps gracefully fail if it doesn't. |
Hi @dstreet any update on this issue? Just wondering if dependsOn.js is still being maintained or has migrated to some other project. |
Hi @hsgubert, |
Hey mate,
It's me again, im looking for the error but not sure what happened to mine, here's my demo page http://demo.comfythemes.com/woocommerce-checkout-template/ you have to add to cart first (on the menu), then go to http://demo.comfythemes.com/woocommerce-checkout-template/checkout/ , viewsource you will get
Can you please take a look?, since it's your core so i dont know how to deal with it.
Thanks mate
The text was updated successfully, but these errors were encountered: