Author: Kevin Lawver

  • Child Scripts Making Child Scripts!

    I’ve been wrestling with a bug in one of my modules for AIM Pages for_ever_, and just found a fix today. I created this well-intentioned module called code snippet that allows you to paste in markup and it’ll get inserted into the DOM. This is really just a stopgap to allow people to add stuff that a module doesn’t exist for yet. I never should have written it. Do you know how bad DOM support is in IE? It’s awful!\
    The big problem is that people wanted/needed to insert script elements with inline script using the code snippet module, and I couldn’t figure out a good way to do it (ok, any way, good or otherwise). Just adding them to the DOM using innerHTML doesn’t work. IE won’t allow you to create a new script element and set the text content to the code.\
    Today, I stumbled on a message board post that hints at the answer. What’s the answer?\
    Create a new script element, and set the text property to the script content and then append it to the body. Voila, actual evaluated javascript! Here’s an example:

    <code>var b=document.getElementsByTagName("body")[0];
    var txt="function doIt(msg) {alert(msg)}";
    var scr=document.createElement("script");
    scr.setAttribute("type","text/javascript");
    scr.text=txt;
    b.appendChild(scr);</code>
    

    Enjoy! Oh, and the fixed version of the module isn’t live yet. I’m letting the QA guys look at it first before I unleash it on an unsuspecting world.

  • Truly Semantic Classes and Ids

    Just a little thought before leaving for work. How funny would it be if we used truly semantic classes and ids in our XHTML? Instead of pretending it’s a “container” or “event-holder” or whatever other text we use to try to fool ourselves into semantic meaning, what if we were truly honest about the role that element was playing? For example:

    • im-no-css-jedi
    • because-multiple-background-isnt-implemented
    • ie-wont-clear-this-damn-thing
    • i-can-hang-another-background-off-this
    • bottomless-pit-for-my-dom-wickedness
    • should-have-been-a-list
    • because-ive-never-heard-of-fieldset
    • must-have-rounded-corners\
      I think it’ll catch on. Got more?
  • Howdy

    This morning while I went out, the dishes didn’t get washed.\
    Then later, when I came home and collapsed on the couch exhausted, the dishes still didn’t get washed.\
    And now, while I am goofing off by typing this, THE DISHES STILL AREN’T WASHED.

  • Why My Site Has Been Down

    I love Dreamhost a lot and usually highly recommend them to everyone, but recently, they’ve had some real problems keeping everything up and running around here. I was glad to see them blog about the trouble and what they’re doing to fix it. I love transparency.

  • Deep Thought

    True love is giving away the last piece of your favorite chocolate candy even though you’re going through PMS.

  • Presentation Remote Solved

    Instead of forking over over \$30 for a new remote to use for presentations, I found mira a little System Preference pane that lets me map the buttons on my brand new MacBook Pro’s remote to other applications. It took about 45 seconds of fiddling to get forward/back mapped to the up and down arrows and voila, I have a presentation remote.\
    I love Mac developers. If I’ve got a problem, there’s usually a beautifully designed easy to use solution already out there.

  • Where’s the beef?

    I spent nearly \$250 at Costco today (some of that was gas) and only \$15 of that was for food. Isn’t that depressing?

  • SxSW Panel Online Finally!

    You can go get the audio from our panel at SXSW (Convincing Your Company to Embrace Web Standards to get the slides) over on their podcasts page, or get the mp3 directly.\
    I just listened to it (Steve listened to it to too, and we traded jokes) and here are my totally shallow observations after listening to myself:

    1. I did a really good job of not talking fast. I talk much faster than that normally.
    2. I sound a little bit like Kevin Smith and that kind of scares me.
    3. Note to self: don’t laugh into the mic
    4. Don’t encourage Marc Canter. No good can come of it
    5. My panelists kicked ass.
    6. Jeremy Keith loves Mr. Chipman\
      It makes me want to do a panel next year… even though it was really stressful getting this one together.\
      Update: Steve and got a transcript from Casting Words, you can go look at it if you want.
  • Thought of the day

    I should have gotten some bing cherries at the store earlier.\
    And a big HAPPY belated BIRTHDAY to my mommy. I knew you’d be offline over the weekend, so I didn’t post this earlier. Love you! Miss you! Ate an oatmeal cookie in fond remembrance of you!

  • Rails, Wow

    I’ve been flirting with it for a while (have had the book since it came out and installed Rails all over the place, just never had time to get into it), but last night I broke down and built my first web application with Ruby on Rails and all I have to say is wow. That was way easier than it should have been. Granted, it was painfully simple, but still, it was about an hour total between setting up the domain and database on Dreamhost to getting it tweaked and looking like I wanted (oh, and working). It was another 5 minutes with the book this morning to get the export feature working like I wanted (well, they wanted).\
    Next time I need to build something outside of work (or hell, maybe inside of work), it’ll most likely be in Rails.