Brad Fitzpatrick (brad) wrote,
Brad Fitzpatrick

Tag autocomplete in JavaScript

Two exciting things...

Tag auto-complete working in IE:
Please check out the tag autocomplete demo:

Known to work in Firefox 1.0.x, Firefox 1.5.x, and IE 6.0.
Won't work in Safari due to Safaril limitations.

Let me know if it works in anything else (Opera?) or if you find any problems in any of the known-working browsers.

Six Apart and open source
Also of note: my employer, Six Apart, has agreed to open source the following JavaScript libraries:

Cooperatively they form a sort of compatibility layer for all major browsers to behave as the W3C says they should.

Ben's historically put a bunch of stuff on CPAN but I believe this is the first time that they've open sourced JavaScript (or any non-Perl) code. I argued that open sourcing JavaScript is the easiest possible decision because you can't control its spread anyway (the browser needs it to run), so you might as well reap the benefits of open source anyway, as long as you're making it available.

The three files above aren't really documented, but are pretty useful. I started using them in this tagcomplete project, but not as much as I could.... still got some reading/tinkering to do until I learn all the stuff in them.

The IE support in tagcomplete, though, (finding the selected region of a text input) was accelerated greatly by using some code from selectionrange.js. It didn't work for me as is, so I forked it for now, but I'll figure it out and get patches back to Randy to include in future version.

That's actually how getting Six Apart to open source these came out: I was asking Randy how to find the selection range of a text input in IE and showed him some ghetto code I'd started playing with (duplicating text ranges and sliding them around and comparing them) and he smiled and said, "Yup. That's right." and told me he'd already done it (in selectionrange.js). Then I decided I didn't want to waste my time doing something that'd already been done so I asked him and Ben if we could open source the above files, and uh, there they are. Enjoy.
Tags: javascript, open source, work
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.