Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#17852 closed defect (invalid)

domConstuct.place

Reported by: artl Owned by: artl
Priority: undecided Milestone: tbd
Component: HTML Version: 1.9.3
Keywords: Cc:
Blocked By: Blocking:

Description

http://dojotoolkit.org/documentation/tutorials/1.9/hello_dojo/

example code segment 2: """ <script>

require([

'dojo/dom', 'dojo/dom-construct'

], function (dom, domConstruct) {

var greetingNode = dom.byId('greeting'); domConstruct.place(' Dojo!', greetingNode);

});

</script>

""" domConstruct.place error. later examples with:

var greeting = dom.byId('greeting'); greeting.innerHTML += ' from Dojo!';

works.

Firefox debug: TypeError?: Argument 1 of Node.appendChild is not an object. dojo.js:154

safari(osx) does not work msie does not work

Change History (6)

comment:1 Changed 6 years ago by bill

Component: GeneralHTML
Owner: set to artl
Status: newpending

Well, do you have a node with id=greeting? Please attach the actual testcase you ran rather than just a code snippet.

comment:2 Changed 6 years ago by ben hockey

also, it's possible you need a 'dojo/domReady!' dependency

comment:3 in reply to:  1 Changed 6 years ago by artl

Status: pendingnew

Replying to bill:

Well, do you have a node with id=greeting? Please attach the actual testcase you ran rather than just a code snippet.

yes <h1 id="greeting">Hello</h1> the tutorial link provided have the code i've tried. copy and paste.

html served from cherrypy on staticdir

comment:4 in reply to:  2 Changed 6 years ago by artl

Replying to neonstalwart:

also, it's possible you need a 'dojo/domReady!' dependency

add dojo/domReady!, same result.

like ive said, later example with var greeting = dom.byId('greeting'); greeting.innerHTML += ' from Dojo!'; works, so dom should be ready?

comment:5 Changed 6 years ago by ben hockey

Resolution: invalid
Status: newclosed

the example has domConstruct.place('<i> Dojo!</i>', greetingNode); but you have domConstruct.place(' Dojo!', greetingNode);. this is an important difference.

from the docs for `domConstruct.place'

node: DOMNode|DocumentFragment?|String

id or node reference, or HTML fragment starting with "<" to place relative to refNode

your node doesn't match this criteria but the one in the tutorial does.

comment:6 in reply to:  5 Changed 6 years ago by artl

Replying to neonstalwart:

the example has domConstruct.place('<i> Dojo!</i>', greetingNode); but you have domConstruct.place(' Dojo!', greetingNode);. this is an important difference.

from the docs for `domConstruct.place'

node: DOMNode|DocumentFragment?|String

id or node reference, or HTML fragment starting with "<" to place relative to refNode

your node doesn't match this criteria but the one in the tutorial does.

Thanks. I see now.

js been disabled on the tuturial page. the code i see/copy is missing the 'code view' w/<i>, perhaps there should be some warning bout that.

Note: See TracTickets for help on using tickets.