If we don’t like this presentation layer, then why do we tolerate it for the behavior layer?

Suppose that CSS, which, as we know, has never been invented, and the closest we could do is to do this:

<script>
// this is the page stylesheet
$(document).ready(function(){
    $('.error').css({'color':'red'});
    $('a[href]').css({'textDecoration':'none'});
    ...
});
</script>

If we were forced to write code, would we have come to terms with this? Or does every developer on Earth yell at browser vendors until they are standardized on CSS, or at least some kind of declarative style language?

CSS may not be perfect, but hopefully it is obvious how better it is than finding things as shown above. So my question is this. We have seen and glorified the fame of declarative CSS bindings, so why, when it comes to the behavioral / interactive level, is the JavaScript community completely satisfied that it continues to use the kludgy procedural method described above? Why, for example, many people think that this is the best way to do something:

<script>
$(document).ready(function(){
    $('.widget').append("<a class='button' href='#'>...</div>");
    $('a[href]').click(function(){...});
    ...
});
</script>

Why is there no massive push for receiving XBL2.0 or .htc files or some kind of declarative behavior syntax implemented in a standard way in browsers? Is this recognized as a necessity by other web development professionals? Is there anything on the horizon for HTML5?

(, ..: , , , . , - , , . -, , , . , , .)

+3
2

** , , , -: $ ().ready(() {   $ ( '') ( "..." ).   $ ( ' [HREF]') (() {...}).   ... }); **

. , , - html. , , . . .

+1

JavaScript , . , DSL, , JavaScript.

0

Source: https://habr.com/ru/post/1740878/


All Articles