bitovi / bitovi/canjs.com

Recipes have wrong order of script and html, does not work as is

Open
#208 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
17
Forks
12
PR merge metrics
No merged PRs in 30d

Description

The first recipe on canjs.com/guides/Recipes.html page (which is used later so essentially nothing works) has html AFTER the scripts which means that it can (and does in my experiments using Chrome and Firefox) execute scripts before div is created so nothing is displayed.

Current text of the example:

``` html

//Template will go here

//Application code will go here


```

div tag should either be before script tags or the code (added to the example later) should be wrapped in $(function(){...}); (or something similar, not sure what is the best option).

I assume people who know jQuery are not stumped by this but if you don't know jQuery (like me) then it's fairly hard to figure out what's not working and why. To add to the confusion jsfiddle does not show (in an obvious way) that it wraps javascript code in window.onload (eventually found that out by looking at source of the frame where it displays the results).

Contributor guide

Open the contributing guide

Research direction

Open the first recipe on the guides/Recipes.html page and compare the script and div order with the example shown in the issue. Verify the corrected recipe in Chrome and Firefox, and consider the documented alternatives before confirming that the example displays the application content.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.