Backbonejs output switches after each update

I am following a tutorial and I am trying to run this code . Every time I update, the following code

console.log(childView.el); 

conclusion between these

 <div id="master" class="container"></div> 

and this:

 div#master.container 

I would like to understand why this is switching. Here is what I see (look at the console).

enter image description here

+7
javascript jquery
source share
2 answers

From what I can tell, Chrome has two different ways to display an item in the console: "DOM way" and "Javascript way". I believe that what you see is Chrome, which first draws the element and then switches to another view right after (i.e. you see a slight error in the developer tools).

0
source share

I think @machineghost is right, this is a bug in the developer tools. The "correct" output is the DOM entry: <div id="master" class="container"></div> . However, when the view is instantiated, the .el property .el resolved from the selector string to the DOM element. Another notation you see is the selector line for the created view.

Although a selector string is used during instance creation, the el property is always set to the DOM element, each time using a detached <div> if no other option is provided.

0
source share

All Articles