have fun with that on mobile where like all browsers, javascript is single threaded
the reason why we use contenteditable is that it can be done in 15kb and the browser can do it natively, then you just clean up the resulting code on the backend
91–100 of 137 posts
have fun with that on mobile where like all browsers, javascript is single threaded
the reason why we use contenteditable is that it can be done in 15kb and the browser can do it natively, then you just clean up the resulting code on the backend
Since they didn't put a demo up on their site, here's one cobbled from their documentation: http://jsbin.com/cazewaxoje/1
Looking through the code, a few things jumped out that should be looked at:
* Native TreeWalker implementations are buggy in some browsers. In the end we decided it was safer to just implement the bit we needed ourselves (see comment at top of https://github.com/neilj/Squire/blob/master/source/TreeWalke...).
* The HTML sanitisation using document.implementation doesn't account for DOM clobbering so is currently bypassable with the right malicious content. I recommend using https://github.com/cure53/DOMPurify for this rather than writing your own. It's tricky to get all the edge cases right, so better to use something that's been reviewed by several people (and in DOMPurify's case also undergone a formal security review). Again, we use this at FastMail as part of our webmail.
Earlier quoted context omitted.
Isn't CoffeeScript the " Macro -assembler" of JavaScript? i.e. a simple 1:1 syntax mapping, without no differentiating semantics of its own. Or am I wrong?
It's neither a subset nor a superset of JavaScript. It's a language that isn't JavaScript that is compiled to JavaScript. There are to-JavaScript compilers for many languages now including Scala, Kotlin, Clojure and more. Maybe people who write CoffeeScript as part of some public thing consider themselves to be part of a JavaScript project, but I wouldn't.
Coffee is just a set of syntactic improvements (well, it's debatable - let's say "syntactic changes") over JavaScript. JS is too weak a language to implement this syntactic sugar inside of it, so there is a need for an external tool. But if you take a look at any Lisp, you'll see that people are building syntactic abstraction inside a language and that it doesn't make their code "a different language compiled to (their kind of) Lisp".
This is not to say that everything compiled down to JS is still JS. But the difference is quite neatly explained in Mathias Felleisen great paper: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.51.4... All that Coffee does are local transformations, equivalent to what you could do with Lisp or Nim or Dylan macros.
[EDIT: removed the "soooo cute" opening sentence, as it was brought to my attention that it distracted readers]
Earlier quoted context omitted.
It's neither a subset nor a superset of JavaScript. It's a language that isn't JavaScript that is compiled to JavaScript. There are to-JavaScript compilers for many languages now including Scala, Kotlin, Clojure and more. Maybe people who write CoffeeScript as part of some public thing consider themselves to be part of a JavaScript project, but I wouldn't.
You know that "languages that compile to JavaScript" (thanks for not using the word "transpiled", btw) include JavaScript? Babel, Traceur - does it ring a bell? Would you argue that their users are not a "part of JavaScript"? What about TypeScript (it's just an implementation of some ES6 features + a powerful linter)? Coffee is just a set of syntactic improvements (well, it's debatable - let's say "syntactic changes"…
I stopped reading your reply after this. Just FYI, HN doesn't condone bad attitudes. You'll end up getting hell banned.
Having said that, my down-voted comments are factual. They are not incorrect, they were down voted by people who have strong emotions about CoffeeScript.
True or false? All the statements below are true.
Trix is writen in CoffeeScript?
CoffeeScript is not superset or a subset of JavaScript?
Are there other languages that compile to JavaScript?
I don't consider projects written in CoffeeScript JavaScript projects?
I gave simple statements of fact that were not incorrect, and they got down voted and emotional replies.
I don't get these simplistic editors. You just have to learn ten HTML tags to do the formatting these editors offer. What would be useful though, would be an editor that supported "design" and not just text.
Earlier quoted context omitted.
hahaha… oh god. This place is such an echo chamber…
Is "what would be useful is an editor that supports design" an echo chamber? Mightbe pretty hard to do right, but not an ordinary idea. About rich text editors, since there are so many editors (even native) that lag on input I have just assumed that is something that only I care about.