DOM Inspection - Ajax Patterns

DOM Inspection

From Ajax Patterns

(Difference between revisions)
Revision as of 08:48, 12 May 2008
222.131.29.156 (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:
-对于红彤[http://www.100woman.cn 美容整形]也许大家还不太相信它的神奇,看看韩国好多整过形的美女演员出演的电视剧,整形前是多么地 
- 
-难看,整形后判若两人,大家看到的都是他们[http://www.100woman.cn 整形]后的美丽容颜,那在中国的整形美容行业发展的怎么样呢?我们 
- 
-现在来设想下,如果要是把网络红人“芙蓉姐姐”整形成香港明星李嘉欣,那么结果会怎么样呢?她们两个不同风格的人能整形出来什么效果 
- 
-?芙蓉能整出李嘉欣的形象气质出来吗?  
-美容整形在国外一直是很热门的产业,许多面部有缺陷的女孩子经过整形以后能成为耀眼的明星。一些[http://www.100woman.cn 胸部整形]过 
- 
-的女星也能跟美国的艳星乔丹相媲美,演艺事业也蒸蒸日上,导演也亲睐她们,经常给她们抛来橄榄枝。[http://www.100woman.cn 处女膜修 
- 
-复]手术,还你一个做纯洁女人的机会,[http://www.100woman.cn 双眼皮] 手术,能给那些单眼皮女生一次跨越的机会,一下子跻身双眼皮行 
- 
-列,男生们好象比较流行单眼皮,像Rain!割个双眼皮,轻松;做个双眼皮,方便;[http://www.100woman.cn 光子脱毛],快捷; 
- 
-[http://www.100woman.cn 清除腋臭],简单;去整形美容医院,给自己一次完美的机会,去雅靓看看,能给你一个意外的惊喜! 
'''Evidence:''' 1/3 '''Evidence:''' 1/3
Line 80: Line 64:
* [http://blogs.msdn.com/ie/archive/2005/05/10/416156.aspx DOM Inspectors for IE] * [http://blogs.msdn.com/ie/archive/2005/05/10/416156.aspx DOM Inspectors for IE]
-[http://www.mmxxy.com 热转印机]  
-[http://www.jingaoda.com 有机玻璃] 
-[http://www.hzst.net.cn IBM服务器] 
-[http://www.hzst.net.cn Dell服务器] 
-[http://www.hzst.net.cn IBM服务器] 
-[http://www.szjlit.com HP服务器]  
-[http://www.szjlit.com CISCO交换机]  
-[http://www.szjlit.com IBM服务器] 
-[http://www.szjlit.com/ibm.html] 
-[http://www.aca007.com 调查]  
-[http://www.edu-embedded.com 单片机培训]  
-[http://www.touch2008.com.cn 工控机] 
-[http://www.greenshunyi.com/ 顺义旅游]  
-[http://www.x8x.org.cn 北京搬家] 
-[http://www.bjsflt.cn 北京搬家] 
-[http://www.cnghf.cn 会议服务] 
-[http://www.cnghf.cn 装饰装潢] 
-[http://www.cnghf.cn 展览制作] 
-[http://www.bj-hz.com 北京装潢公司] 
-[http://www.newshunyi.cn/ 顺义房产] 
-[http://www.bj-hz.com 北京装饰公司] 
-[http://www.bj-hz.com 北京装修公司] 
-[http://www.bjhmay.com 北京月嫂] 
-[http://www.bjztlilo.com 门窗厂] 
-[http://www.fp98.com.cn 代开发票]  
-[http://www.whstwl.com 北京物流]  
-[http://www.x8x.org.cn 北京搬家]  
-[http://www.bjztlilo.com 门窗厂] 
-[http://www.kangdabaojie.cn 北京保洁]    
-[http://www.hple.com.cn自动门] 
-[http://www.fp98.com.cn 代开发票] 
-[http://www.bj-hqnh.com 北京汽车陪练]  
-[http://www.gmstktwx.cn 空调维修]  
-[http://www.bjwrkt.com 空调回收] 
-[http://www.bjhty.com 大金中央空调] 
-[http://www.bjhty.com 电地暖] 
-[http://www.bjhty.com 冷库] 
-[http://www.bjhty.com 格力中央空调] 
-[http://www.bjhty.com 约克中央空调] 
-[http://www.bjfmj.com 风幕机]  
-[http://www.jkchangjiu.cn 劳保用品]  
-[http://www.bjtxsd.com 北京物流公司] 
-[http://www.bjzhjt.com 机柜] 
-[http://www.bjzhjt.com 机柜] 
-[http://www.beizhong.com 电机修理]  
-[http://www.khcoo.com 净化工程]  
-[http://www.bjhyzr.com 五粮液酒]  
-[http://www.bjjds.cn 燃气灶维修] 

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


Contents

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.


Problem

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


Solution

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 [http://www.clagnut.com/blog/340/ 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.

IEDocMon

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?