Category: Web

link

That SXSW panel I was on the other day (I am, um, awful at self‐promotion, even on my own blog) has already been released via podcast, to my own astonishment. John Resig‘s got the slides, so as soon as he posts them I’m sure we’ll find a way to synchronize them to this audio.

thought

On occasion I surprise myself by writing an epistle on a subject I didn’t know I cared much about. I’m bad at writing blog posts, but I’m good at writing comments that become blog posts just because I won’t stop typing. I need to spot them more quickly and usher them back into the flock.

thought
1

I understand that nothing gets people yelling at each other like a meaty discussion on accessibility, but I’m not getting why the idea of making alt optional on img tags in HTML5 is causing such a furor. The alt attribute is the lowest of the low‐hanging accessibility fruit, and the number of people on earth who care about valid HTML — but don’t care even a little about accessibility — could fit into my pants. Get more people interested in validating their HTML; then we’ll talk.

link

Thomas and Amy apparently don’t have enough awesome stuff going on yet, so they’ve decided to release a book on JavaScript performance. Thomas tells me his findings have some implications for how we package Prototype & script.aculo.us.

quotation

Convenient though it would be if it were true, Mozilla is not big because it’s full of useless crap. Mozilla is big because your needs are big. Your needs are big because the Internet is big. There are lots of small, lean web browsers out there that, incidentally, do almost nothing useful. If that’s what you need, you’ve got options.

jwz

Paginate THIS

Posted in Articles, Design, User Interface, Web

Here’s a lovely pagination control I looked at on PSDTUTS today. Actually, first I used it; when it took me to a page I was not expecting, I hit the Back button and looked at it. It’s a testament to both my arrogance and my compulsiveness that I found five

Read more →
code
1

Code: Disabling text selection

Inspired by Thomas’s classic and event delegation.

/**
 *  Element.enableTextSelection(element, isEnabled)
 *  
 *  Enables or disables text selection within the given element.
 *  - element (Element): The element within which a dragging motion
 *    _should_ or _should not_ behave like text selection.
 *  - isEnabled (boolean): Whether to enable or disable text selection.
**/
(function() {
  var IGNORED_ELEMENTS = [];
  function _textSelectionHandler(event) {
    var element = Event.element(event);
    if (!element) return;
    for (var i = 0, node; node = IGNORED_ELEMENTS[i]; i++) {
      if (element === node || element.descendantOf(node)) {
        Event.stop(event);
        break;
      }
    }
  }
  
  if (document.attachEvent)
    document.onselectstart = _textSelectionHandler.bindAsEventListener(window);    
  else
    document.observe('mousedown', _textSelectionHandler);
    

  Element.addMethods({
    enableTextSelection: function(element, isEnabled) {
      if (isEnabled) {
        IGNORED_ELEMENTS = IGNORED_ELEMENTS.without(element);
      } else {
        if (!IGNORED_ELEMENTS.include(element))
          IGNORED_ELEMENTS.push(element);
      }
    }
  });
})();