aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes jQuery question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "jQuery question" Watch "jQuery question" New topic
Author

jQuery question

Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 629
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.

Be Humble... Be Nice.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 629
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

Joined: Jan 10, 2002
Posts: 61764
    
  67

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

Joined: Nov 10, 2007
Posts: 629
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

Joined: Jan 10, 2002
Posts: 61764
    
  67

HTML is just text markup. All JavaScript operates on the DOM, not just jQuery.
Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 629
Bear Bibeault wrote:HTML is just text markup. All JavaScript operates on the DOM, not just jQuery.


Thanks Bibeault.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jQuery question