Skip to content

{ Category Archives } Javascript

IE11 bug with Ranges

Try the demo in Internet Explorer 11 and in a real browser. IE now implements Range objects, representing a range of text that may span several elements. It's the basis for the standards-based part of bililiteRange. And it almost works. It's a little flaky: inserting text that contains '\n' without '\r', what I consider the […]

Better Javascript testing

Evidently I'm doing test-driven development wrong. Or at least it could be easier. I will have to look at Google's karma to automate the testing (rather than running the test suite in each browser individually). That of course means I need to start using Node's npm package manager (which I probably should anyway, since all […]

IE 11 bugs

Turns out Internet Explorer is even worse than imagined. It's right at the bottom of the Uncanny Valley--close enough to a real browser to make it look like it works, but lots of near-impossible-to-track-down bugs that make life miserable. Turns out that Node.normalize is broken (see the bug reports and a workaround), so I had […]

Internet Explorer 11 Mysteries

Trying to debug bililiteRange in IE11; some of the problems were easily fixed with .replace(/\r/g, '') liberally scattered about, since IE really likes its return characters in <div>s (anything that is not a <textarea> or an <input> and will add them even if I am just inserting a newline. I'm still getting a WrongDocumentError on […]

bililiteRange and Internet Explorer 11

Well, I ran the test code for bililiteRange and got "132 assertions of 151 passed, 19 failed." Better than none passed, I suppose, but it means I've got some work ahead of me. Or I could just give up on IE, but IE11 is supposed to be standards-compliant, so the errors might actually reflect a […]

flexcal with European date formatting

The question came up about using "European" dates (day/month/year) rather than "American" dates (month/day/year) in flexcal. The biggest problem is that the built-in Date.parse() (which is used by new Date(string)) uses the American format, at least with my browsers and settings. The code in flexcal that does the formatting are in the following methods: format({Date}) […]

bililiteRange data

There have been a lot of times I have needed some information for a bililiteRange plugin that was associated with the underlying element, rather than a specific range. For instance, in bililiteRange(element).text('foo') then bililiteRange(element).undo() the undo needs to know about the previous text change. jQuery has a data() method that attaches an object to the […]

flexcal with “Today” button

Someone asked about adding a "today" button/link to flexcal. It's actually pretty simple: <input id="date1"/> $('#date1').flexcal({'class': 'multicalendar', calendars: ['en','he-jewish']}); var todaylink = $('<a>Today</a>').attr({ 'class': 'commit', rel: $.bililite.flexcal.date2string(new Date), title: $('#date1').flexcal('format', new Date), style: 'text-decoration: underline; cursor: pointer' }); $('#date1').flexcal('box').find('.ui-flexcal').append(todaylink); The key is the todaylink which I append to the calendar (the $('#date1').flexcal('box').find('.ui-flexcal') line). The underlying […]

New features for bililiteRange

I liked the way Dabblet does autoindenting (entering a new line copies the whitespace from the beginning of the current line, so you keep the same level of indentation). So I added an option to bililiteRange(element).text() to do that. Now bililiteRange(element).text('text to insert', select, true) with true passed as the last option will autoindent. My […]

Thoughts on Test Driven Development

I was just working on adding autoindenting to bililiteRange, and actually took advantage of the fact that I had an automated test harness in place for that library. So I actually used test-driven development: write the tests for the code that doesn't exist yet, then write code until they pass. It's an odd way of […]