1

jQuery is a fucking garbage of the 21st century. Endless ugliest ever mapping of html element values to JSON and back. Every fucking time.

Comments
  • 1
    hmmm ... whats so horrible about it?

    var json = $("#form").serializeArray().reduce(function(old, now){
    old[now.name] = now.value;
    return old;
    }, {});

    for(var prop in json){
    $("#form").find(":input[name="+prop+"]").val(json[prop]);
    }
  • 0
    @tkdmatze in your ex. you do conversion for very basic structure (<form> <input name... <input name... <input name... </form>). In MANY cases structure is much more difficult, it includes arrays, JSONs, properties, etc. jQuery unfortunately don't have (even in 2018) easy mechanisms to operate that("translate JSON<->inputs"). There are frameworks like Angular,React which actually help very much with this.
  • 1
    @pavloomelchenko
    Working with a legacy Angular site here, so i may be biased, but Angular helps bad decisions to be easy to implement

    JQuery is based on the html/css Standards, Angular extends these or is making their own

    So no need that jquery solves problems coming from angular
Add Comment