没有必要将每个测试包装在括号中,这使得代码更难以为我阅读。 HTML节点将按照惯例以大写字母的形式返回其名称 ,XML节点可能会混合使用大写和小写。对于HTML 文档,建议使用不区分大小写的测试,例如: if(the_opts [i] .nodeName.toLowerCase()== " input"){There is no need to wrap each test in brackets, it makes the codeharder to read for me. HTML nodes will return their name in capitalsby convention, XML nodes might be mixed upper and lower. For HTMLdocuments it is recommended to use a case-insensitive test such as: if ( the_opts[i].nodeName.toLowerCase() == "input" ) { 任何提示,如果有偏好使用.toLowerCase()而不是 ..toUpperCase() ?我通常使用.toUpperCase()。 但是,我的意思是,因为HTML约定是返回大写的 版本和XML格式的混合版本似乎更常用大写的 版本。是否更好(在性能和可靠性方面) 小写或大写?或者只是不在乎。情况,并且 两种选择都是等价的? 我希望我的坏英语不是一个提示的问题。谢谢。 - laurentAny hint if there is a preference to use .toLowerCase() instead of..toUpperCase() ? I use .toUpperCase() usually.But, I mean, since the HTML convention is to return a capitalizedversion and a mixed one in XML it seems more often in capitalizedversion. Is it better (in performance and reliability terms) to golowercase or uppercase ? Or is it just a "don''t care" situation, andboth choices are equivalents ?I hope my bad english is not an issue to get a hint. Thanks.--laurent 这篇关于简单背景变更问题..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-05 08:46
查看更多