Skip to content

{ Monthly Archives } December 2013

DOM 3 events for bililiteRange

I've been looking at the DOM 3 event model and decided that the bililiteRange.text() methods ought to implement those, even though they're not in browsers yet. Nobody implements beforeinput, or in the input event handler, and select only works in <input> and <textarea> (not in contenteditable). And that's in modern browsers. But that's […]

Debouncing Prism.editor

Prism is fast, generally fast enough to use for a live syntax highlighter. But for large texts (multiple kilocharacters) having the text re-highlighted with every input bogs down, and I can type faster than the text can show up. I remember old word processors that were like that, back in the dark ages of computerdom. […]

bililiteRange undo

This is a plugin for bililiteRange that implements a simple undo/redo stack. It listens for input events (so to use it in IE

Bitten by the asynchronous bug

As luck would have it, right after I wrote about synchronous vs. asynchronous event handlers, I found exactly that problem in by bililiteRange code. It uses dispatchEvent to fire an input event when text is inserted, but that fires synchronously, so that the event handlers run before the bililiteRange.text() has fully run. I ended up […]

Update status

As promised, I have updated the status plugin to use Promises. Unfortunately, that required a small change to the parameters. Since I doubt anyone is using it, that will not likely affect anyone but me. The version is now 1.1.

Promises and Event Handers

There's a subtlety in using Promises with event handlers or any code that's executed asynchronously. Promises are supposed to be used for future values, with the reject handler acting like an exception handler, so that the Promise constructor actually catches real exceptions and turns them into rejects (from the polyfill; I assume the browser-implemented code […]

Promises API

Just in time for me to start thinking about Javascript Promises, comes along an official API, along with a polyfill that basically re-implements rsvp.js with the "official" terminology. Now for some experimenting (and rewriting jquery.status.js to use real Promises). It seems from all the discussion that jQuery $.Deferred are not and will not be real […]

Simple syntax-highlighting editor with Prism

Prism is a great Javascript syntax highlighter, and it's fast enough to be used on the fly for active editing; Lea Verou (the author) does this with Dabblet. Combined with bililiteRange to handle some of the subtleties of dealing with contenteditable elements, a syntax-highlighting editor is relatively easy. Simplest usage: bililiteRange.fancyText(element, Prism.highlightelement);. See the demo. […]

Thinking about synchonicity

I've been looking at Promise/A+ as a way to abstract future values, or values that depend on something the user will do later, specifically Yehuda Katz's rsvp.js, and came across Domenic Denicola's You're Missing the Point of Promises, which got me looking at Oliver Steele's Minimizing Code Paths in Asychronous Code. Now I have another […]

New jQuery plugin, status

This plugin is obsolete. See the new status at Updated 2015-01-19 to allow $(console).status(). Now at version 1.4. Updated 2013-12-18 to use Promises. This necessitated removing the result option and adding the returnPromise. Updated 2014-01-09 to add initialText option and to document the markup used. For the Kavanot editor I wanted to have a […]