DOM Inspection - Ajax Patterns

DOM Inspection

From Ajax Patterns

(Difference between revisions)
Revision as of 08:48, 12 May 2008 (Talk | contribs)

← Previous diff
Revision as of 09:40, 18 November 2008
Mahemoff (Talk | contribs)
Want to Know More?
Next diff →
Line 1: Line 1:
-对于红彤[ 美容整形]也许大家还不太相信它的神奇,看看韩国好多整过形的美女演员出演的电视剧,整形前是多么地 
-难看,整形后判若两人,大家看到的都是他们[ 整形]后的美丽容颜,那在中国的整形美容行业发展的怎么样呢?我们 
-美容整形在国外一直是很热门的产业,许多面部有缺陷的女孩子经过整形以后能成为耀眼的明星。一些[ 胸部整形]过 
-的女星也能跟美国的艳星乔丹相媲美,演艺事业也蒸蒸日上,导演也亲睐她们,经常给她们抛来橄榄枝。[ 处女膜修 
-复]手术,还你一个做纯洁女人的机会,[ 双眼皮] 手术,能给那些单眼皮女生一次跨越的机会,一下子跻身双眼皮行 
-列,男生们好象比较流行单眼皮,像Rain!割个双眼皮,轻松;做个双眼皮,方便;[ 光子脱毛],快捷; 
-[ 清除腋臭],简单;去整形美容医院,给自己一次完美的机会,去雅靓看看,能给你一个意外的惊喜! 
'''Evidence:''' 1/3 '''Evidence:''' 1/3
Line 80: Line 64:
* [ DOM Inspectors for IE] * [ DOM Inspectors for IE]
-[ 热转印机]  
-[ 有机玻璃] 
-[ IBM服务器] 
-[ Dell服务器] 
-[ IBM服务器] 
-[ HP服务器]  
-[ CISCO交换机]  
-[ IBM服务器] 
-[ 调查]  
-[ 单片机培训]  
-[ 工控机] 
-[ 顺义旅游]  
-[ 北京搬家] 
-[ 北京搬家] 
-[ 会议服务] 
-[ 装饰装潢] 
-[ 展览制作] 
-[ 北京装潢公司] 
-[ 顺义房产] 
-[ 北京装饰公司] 
-[ 北京装修公司] 
-[ 北京月嫂] 
-[ 门窗厂] 
-[ 代开发票]  
-[ 北京物流]  
-[ 北京搬家]  
-[ 门窗厂] 
-[ 北京保洁]    
-[ 代开发票] 
-[ 北京汽车陪练]  
-[ 空调维修]  
-[ 空调回收] 
-[ 大金中央空调] 
-[ 电地暖] 
-[ 冷库] 
-[ 格力中央空调] 
-[ 约克中央空调] 
-[ 风幕机]  
-[ 劳保用品]  
-[ 北京物流公司] 
-[ 机柜] 
-[ 机柜] 
-[ 电机修理]  
-[ 净化工程]  
-[ 五粮液酒]  
-[ 燃气灶维修] 

Revision as of 09:40, 18 November 2008

Evidence: 1/3

Tags: DOM Dynamic Explore Inspect Interrogate Investigate Presentation Render Snapshot State View Visualise Visualize


Goal Story

Devi keeps clicking on the Clear button, but the document text remains unaffected. She fires up a DOM Inspection tool, and discovers that the button's onclick event handler isn't present, which would explain why nothing was happening. Reloading the application, the DOM inspector shows her that the event handler is initially present, but removed upon the first clear operation and never restored.


How can you inspect the DOM's state at any time, taking into account DOM manipulations since the page was loaded?


Use a DOM Inspection Tool to explore the dynamic DOM state. The initial HTML for an Ajaxian application is often minimal, and in any event likely to change over time due to DOM Manipulation. A DOM Inspection tools traverses the browser's current DOM model, rather than the initial HTML source, to build up a presentation of the current DOM. Many times, the tool is interactive, allowing you to drill down the hierarchy, search for keywords, and so on. All this is very useful for checking assumptions and diagnosing problems, since many Ajax bugs arise because the programmer misunderstood the DOM state at a particular time.

Incidentally, DOM inspection is useful beyond the fact that the DOM is dynamic. Even for static applications, an interactive exploration tool is often a good complement to the pile of text that makes up a complex HTML document.

Tool Support

Firefox DOM Inspector

Firefox ships with a DOM Inspector tool, accessible from the tools menu in Windows, you need to ensure [ Web Developer Tools is selected during installation. The inspector is a popup window, showing the DOM hierarchy on one side, facing a summary of the selected node. The summary shows node attributes such as registered event handles, as well as CSS style information.

Firefox Web Developer Extension

Chris Pederick's Web Developer is an invaluable Firefox toolbar for web development. Among its vast feature set are several commands especially relevant to DOM Inspection:

  • Display commands augment the page with DOM information, which makes a great alternative to exploring the DOM in a completely separate view. For example, Display Topographic Information alters the page to reveal the layout of DOM elements and Display ID and Class Details augments each element with its id and class attributes.
  • Outline commands draw outlines around elements of a particular type. For example, Outline Block Level Elements or Outline Table Cells. In fact, you can define custom outlines to outline any element you want.
  • Form commands help expose form structure. Display Form Details augments the form with information about each control, while View Form Information opens up a summary page.

View Rendered Source

Jennifer Madden's View Rendered Source is a Firefox extension that shows the entire DOM as an HTML document. Note that this is not the same thing as the good old View Source feature, because the rendered source reflects the DOM after any manipulation has taken place. The rendered source is shown in a pretty-formatted style, using colours and spacing to help convey the DOM structure. This is a free tool, though there's a slightly enhanced version that can be purchased for a small fee.

IE Developer Toolbar

Microsoft's free IE Developer Toolbar, for IE6+, has a number of DOM Inspection capabilities and is similar to the Firefox Web Developer Extension.


Tim Tabor's IEDocMon is an open-source tool that extends IE to include an interactive view of the DOM.

Mouseover DOM Inspector

Steven Chipman's Mouseover DOM Inspector is a convenient bookmarklet that lets you explore the DOM by mousing over page elements. It works on all recent browsers except Safari.

Related Patterns

Want to Know More?