long7181226 / compatibility-detector

Automatically exported from code.google.com/p/compatibility-detector
Apache License 2.0
0 stars 0 forks source link

SD9006 get_and_set_attribute #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
------------------------------[误报](待讨论)
set/getAttribute 
对于有映射关系的属性,多数时候的操作都可以在 IE 
和其他浏览器中通用,因为用户多半只是为了实现效果,而��
�强调值的数据类型。
但在判断值的数据类型时,在不同的判断方法里则不一定通��
�。

测试用例:
get_and_set_attribute_has_binding.html

URL:
http://auto.qq.com/
...

------------------------------[漏报]
对于一些 IE only 的属性名,Chrome 不支持,但没有报出错误。
如 className(即 class属性) htmlFor(即 for 属性)。

测试用例:
get_and_set_attribute_ie_only.html

------------------------------[误报]
1.class和className 同时被setAttribute时,不会有兼容性问题-->误报

测试用例:
both_set_className_class.html

URL:
http://boutiques.orange.fr/
http://dailydeals.target.com/
http://emedicine.medscape.com/

2.页面引入prototype.js库,会有误报。

prototype.js代码:
    var PROPERTIES_ATTRIBUTES_MAP = (function(){
        var el = document.createElement('div'),
            isBuggy = false,
            propName = '_countedByPrototype',
            value = 'x'
        el[propName] = value;
        isBuggy = (el.getAttribute(propName) === value);
        el = null;
        return isBuggy;
    })();
URL:
http://dc.sbnation.com/2010/9/6/1673532/boise-st-virginia-tech-miracle-catch
http://cookpad.com/
http://condescargadirecta.com/
http://beritasemasa.com/
http://ecodiario.eleconomista.es/sociedad/noticias/2420858/09/10/Deberia-dimitir
-Jesus-Neira-de-su-cargo-publico.html
http://es.netlog.com/
http://es.privalia.com/public
http://fr.cam4.com/
http://www.ikea.com/de/
http://interactivo.eluniversal.com.mx/external/podcast/n_podcast.html
http://justlia.mtv.uol.com.br/
http://kb2.adobe.com/cps/000/6b3af6c9.html
http://menoob.com/iphone/how-to-recover-your-iphone-files-photos-contacts-notes-
sms-call-history-etc/
http://my.mail.ru/community/mailruturkish/journal
http://net.sapo.pt/
http://newyork.mbfashionweek.com/
-----------------------------------------------------
http://blog.linkedin.com/
http://www.alexistexas.com/
http://bossip.com/
http://hackulo.us/forums/

Original issue reported on code.google.com by sundongguo on 15 Nov 2010 at 9:12

GoogleCodeExporter commented 9 years ago
2.页面引入prototype.js库,会有误报。

测试用例:
getAttribute_in_prototype.html

Original comment by duanli...@beyondsoft.com on 15 Nov 2010 at 9:23

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by sundongg...@beyondsoft.com on 24 Nov 2010 at 8:25

GoogleCodeExporter commented 9 years ago
1. Fix 了数种文章中提到的漏报的情况。
2. 单独针对 prototype.js 的误报做了过滤

Original comment by wangju...@beyondsoft.com on 3 Dec 2010 at 2:25

GoogleCodeExporter commented 9 years ago

Original comment by wangju...@beyondsoft.com on 7 Dec 2010 at 3:26

GoogleCodeExporter commented 9 years ago
本轮测试有误报,准确率 16.7% (5/30)

由于出现极多 jQuery 代码的误报,本次代码 Fix 先过滤掉对 
jQuery 的误报,以便在下轮测试中缩小查找误报范围。

------------------------------[误报] #1

当设置属性 'async', 'defer', 'disabled', 'checked', 'multiple', 
'selected', 'compact', 'declare' 时,所有浏览器下 
element.defer、element.disabled 等得到的值均为布尔值 true 或 
false。

测试样例:

attributes_readonly_disabled_defer_etc.html

URL:

http://apps.hi.baidu.com/share/detail/10200569
http://allwomenstalk.com/sexy-you-sexiest-movie-love-scenes/

------------------------------[误报] #2

当 SCRIPT.setAttribute('src', url) 或 A.setAttribute('href', url) 中的 url 
是相对路径时,SCRIPT.src 和 A.href 得到的是绝对路径,此时 
url != SCRIPT.src && url != A.href, 会有误报。

测试样例:

href_src_relative_path_file.html

URL:

http://data.ent.163.com/star/product/00000OJZ.html
http://baike.baidu.com/view/1000.htm
http://data.ent.163.com/star/product/00000OJZ.html

----------------------------- Won't Fix

1. jQuery, Sizzle: E.getAttribute("style") 

URL:

http://aq.qq.com/cn/index
http://appserver.lenovo.com.cn/lenovo_brand_list.aspx?categoryid=3
http://3.zol.com.cn/194/1945677.html
http://365jia.cn/news/2010-09-07/46C7F6AADF0CBC21.html
http://apple4.us/
http://data.auto.sina.com.cn/395
http://data.ent.sina.com.cn/star/735.html
http://driver.zol.com.cn/detail/10/90806.shtml
http://dl.it.com.cn/soft/2005/09/12/13764.html
http://3dpregnancy.parentsconnect.com/
http://about.skype.com/
http://allrecipes.com//Recipes/desserts/Main.aspx
http://allwomenstalk.com/sexy-you-sexiest-movie-love-scenes/
http://blogs.babble.com/famecrawler/2010/11/02/demi-lovato-rehab-is-justin-biebe
r-the-reason-or-his-fans/
http://charlotte.craigslist.org/
http://en.wikipedia.org/wiki/AOL
http://elections.nytimes.com/2010/results/alaska
http://twitter.com/bing

2. jQuery: J.setAttribute("style","xx")

URL:

http://3.zol.com.cn/194/1945677.html

3. 类似:e=o.getAttribute("safename")||o.safename;

URL:

http://boxer.senate.gov/
http://code.google.com/apis/maps/index.html

----------------------------- 准确

http://bbs.soosou.com/dispbbs_4_18394.html
http://bbs.pcpop.com/061102/164276.html
http://bbs.huanqiu.com/
http://abcfamily.go.com/
http://support.dell.com/support/downloads/index.aspx?c=us&l=en&s=gen

Original comment by wangju...@beyondsoft.com on 7 Dec 2010 at 8:36

GoogleCodeExporter commented 9 years ago

Original comment by wangju...@beyondsoft.com on 7 Dec 2010 at 8:56

Attachments:

GoogleCodeExporter commented 9 years ago
本轮测试有误报,准确率 70% (14/20)

Fix 一个 isCalledFromJquery 函数的死循环 bug。

------------------------------[误报] #1

data 属性同上一次分析中的 src 和 href 属性情况,在 
setAttribute 中应过滤。

测试样例:

data_href_src_relative_path_file.html

URL:

http://shop.orange.co.uk/
http://gov.ca.gov/
http://ireport.cnn.com/docs/DOC-514315?ref=feeds/oncnn
http://www.asda.jobs/
http://2am.ibighit.com/
http://www.lottetour.com/

------------------------------[误报] #2

getAttribute() 中当 width="200px" 或 height="200px" 这种情况时,在 
IE6 IE7 IE8 中 getAttribute('width') 或 getAttribute('height') 时返回 
200。 

测试样例:

IMG_width_height_getAttribute.html

------------------------------[准确]

http://rent.soufun.com/
http://esf.soufun.com/
http://dc.pconline.com.cn/
http://fitness.pclady.com.cn/jf/
http://mp3.pchome.net/
http://www.ups.com/cn
http://bbs.xxyw.com/
http://beauty.pclady.com.cn/hairstyle/
http://price.pcauto.com.cn/brand.jsp?bid=44
http://showbiz.sky.com/
http://www.apple.com/ipad/
http://www.dell.co.in/
http://caranddriving.net/1317
http://magazinej.tistory.com/1196

Original comment by wangju...@beyondsoft.com on 9 Dec 2010 at 3:45

Attachments:

GoogleCodeExporter commented 9 years ago
本轮测试有误报,准确率:87%(20/23)

------------------------------[误报] #1
当使用类似 'jsselect' 作为 getAttribute()的参数时,会报错。

测试样例:
getAttribute_jsselect_etc.html

URL:
http://www.52maps.com/world.asp
http://maps.google.co.in/

------------------------------[误报] #2
当在不存在 'multiple', 'disabled' 
等特性的元素上,使用这些参数调用 getAttribute() 
时会有误报。

测试样例:
getAttribute_multiple_etc.html

URL:
http://store.apple.com/us

准确:

1. getAttribute('width')

http://bbs.0538.com.cn/
http://bbs.kafan.cn/forum.php?mod=forumdisplay&fid=93&filter=&orderby=lastpost&&
page=3
http://rent.jn.soufun.com/
http://sky123.org/
http://play-free-online-games.com/games/games_rpg.html
http://online.wsj.com/article/SB10001424052748704462704575590510679315310.html

2. setAttribute('style')

http://womenclothing.eachnet.com/
http://cn.msn.com/ie8/default.html
http://blogs.wsj.com/digits/2010/11/02/google-translate-takes-on-poetry/
http://edition.cnn.com/2010/WORLD/americas/11/02/tropical.weather/
http://games.yahoo.com/game/bouncing-balls

3. get and set attribute onEvent:

http://comic.sky-fire.com/HTML/AIR-Gear/
http://crictime.com/server2.htm
http://thenewsoftoday.com/2010-election-exit-poll-result-times-and-rules/4556/
http://www.riverisland.com/Online/

4. IE下能获得但是 chrome 下无法获得:

http://movie.youku.com/om/
http://wenwen.soso.com/z/c1095041024.htm
http://sqjt.beijing.cn/zf/gjj/
http://get.adobe.com/cn/reader/
http://news.cnet.com/8301-1023_3-20021542-93.html

Fix bug:

过滤掉 setAttribute 和 getAttribute 参数不足的情况
将 this[attributeName] 修改为 this.hasOwnProperty(attributeName)
在 onEvent 的情况中更精确判断属性名称为 onEvent 
的形式,过滤类似 'jsselect' 的情况
对于标签并不应该存在的属性,比如 UL 的 multiple 
,不应该报错。精确属性及对应元素。

Original comment by wangju...@beyondsoft.com on 17 Dec 2010 at 7:33

Attachments:

GoogleCodeExporter commented 9 years ago
won't fix. 
主要是由于虽然脚本中的代码可能有兼容性问题,但都被开��
�者使用逻辑判断解决了。暂时无解决方案。

Original comment by wangju...@beyondsoft.com on 20 Dec 2010 at 7:49