开发者

Does jQuery encourage laziness and dis-organized UI designs? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel开发者_如何学JAVA that this question can be improved and possibly reopened, visit the help center for guidance. Closed 12 years ago.

When I see a question such as: How do I exclude elements whose ID ends in a certain suffix using jQuery I cannot help but thinking: does jquery encourage too much of this sort of ad hoc (and processor intensive) querying of the DOM? Shouldn't we be organizing our UI's better so that these sorts of queries are kept to a minimum, if not entirely eliminated.


Does it encourage it? No, I don't think so. Does it better enable it? Sure you could argue that, but it's not jQuery specific, any library with a selector engine is guilty of the same thing.

How is this different from any framework though?

Specific to the topic at hand, I think "if not entirely eliminated" is unrealistic, what's the alternative, give every single element it's own ID? You often need to traverse, for example this menu when hovered opens its own children, etc.

I fully support as clean a DOM as possible, because it also results in the cleanest script possible (and eliminates it where possible). I'm also in favor of using CSS where CSS will do the job, e.g. I think the simple things like :hover are ignored far too often.

Complete opinion: Is this jQuery's fault? No, not really, unless the fault is being extensible and user-friendly, it's just has a very low entry threshold and it can more easily be the tool of the lazy developer. Whatever's the easiest-to-use library will also keep that crown, comes with the territory (and I'm not saying that's jQuery, depends on the developer as to what library if any is the easiest to use).

What you're talking about is the developer's fault, they're the one not learning about one technology (HTML) and trying to band-aid it with another (JavaScript). The root of the problem doesn't lie in jQuery being a possible solution, it lies it the fact any solution is needed in the first place.


So many elements of poor web design can be patched with javascript. It's a smell that's all too prevalent on the web

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜