• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jQuery question

 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read that almost everything we do when using jQuery reads or manipulates the document object model (DOM). I kind of do not understand what DOM is. I read in Wikipedia that DOM is a way of representing xml and html pages. Does that mean, the elements in the HTML page or XML page are represented in the form of objects in DOM? Can anyone please explain me in simple words?

Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64961
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arjun Reddy wrote:I read that almost everything we do when using jQuery reads or manipulates the document object model (DOM).
jQuery makes it easy to manipulate the DOM, but only if that's your intent. There're many calls that do not touch the DOM.

Does that mean, the elements in the HTML page or XML page are represented in the form of objects in DOM?
Yes. The DOM is the in-memory representation of the elements in the document.
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
Arjun Reddy wrote:I read that almost everything we do when using jQuery reads or manipulates the document object model (DOM).
jQuery makes it easy to manipulate the DOM, but only if that's your intent. There're many calls that do not touch the DOM.

Does that mean, the elements in the HTML page or XML page are represented in the form of objects in DOM?
Yes. The DOM is the in-memory representation of the elements in the document.


Thanks for answering all the questions Bibeault I have 2 more questions on this concept

1). I believe DOM and DOM parser are not the same. Correct?

2). DOM is an in Memory representation of HTML or XML documents right? What's the memory here? database? Sorry, I kind of always get confused with the in-memory thing.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64961
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Correct, mostly because I'm not sure what a "DOM parser" is. An HTML parser, or XML parser, will create a DOM from an HTML or XML document.

2) Memory is where the computer stores data that it is actively working with. See.
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, So this is what I have understood about jQuery now. jQuery is JavaScript which does not work on HTML elements but it works on Document object model's object representation of those elements. Right? if that's true, why not work on the html elements and work on the DOM object representation of those html elements?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64961
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTML is just text markup. All JavaScript operates on the DOM, not just jQuery.
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:HTML is just text markup. All JavaScript operates on the DOM, not just jQuery.


Thanks Bibeault.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic