Bluffing your way thru dom scripting

This will be my first panel. While I wait for things to get going, just a quick note about the morning. Spent the morning with H at her friend/boss’s house, helping to put mulch around plum trees. I haven’t worked that hard outside in that hot a weather since I was 17. But it was weirdly fun. Rural central Texas is quite beautiful, even if it also features intense heat and fire ants.

And I did get fed.

Now I’m back, caffinated, and the panel’s getting started.

“This will be easy because all you have to do is bluff” — Dom scripting is the new css. 🙂 They have comfy chairs onstage!

Jeremy Keith is there with Aaron Gustafson — ALA editor and a teacher.

DHTML vs DOM scripting….DHTML as the original bluffing. confusing…that’s how I always felt about it. “end up forking yourself and your application.” nothing particularly new (to me) here. guy in front of me is wearing an A List Apart shirt. Aaron had the same take on JS that I did for most of the last 5-7 yrs.

DOM scripting as the standards approach to scripting.

The Document. yr basic x/html document, nicely formed.

The Tree, with its nodes. Then the nodes inside a paragraph…I’m suddenly reminded of that video of going down really small with a microscope and really big with a telescope.

back to Jeremy. the dom being another way of looking at a page. use the skills you have in css/markup. (show of hands. mmmm….css nerds.) “getters” and “setters”

getter { setter; } …as in… #footer { font-size: small; }

in dom scripting, getting and setting are separate operations.

method ~= function
property ~= variable

if parentheses, then method. getElementById “does what it says on the tin”. to use getAttribute, you have to already have gotten the element. (this is a good refresher from the book. I want to find a quiet corner with the book and do some experimentation.)

“it’s not an array, but it plays one on TV” (getElementsByTagName). very much like PHP in its looseness, I think.

get the element with the id “content”

#content { }

document.getElementById(“content”)

get all the paragraphs in a document

p { }

document.getElementsByTagName(“p”)

dom is actually readable, because of verbosity.

get all the paragraphs within the element within the element with the id “content”

#content p {}

document.getElementsById(“content”).getElementsByTagName(“p”)

this is why his book worked so well for me!

“creating life!” — “unlimited power” (cranky quasi-joke re: Bush from Aaron.)

starting by showing the old way. document.write() and its cousin innerHTML. well supported but completely proprietary. like using a sledgehammer to crack a walnut.

then the new way. document.createElement(tagname) — document.creat…

“don’t need to memorize this stuff, you can look it up” — don’t I have this bit of his book marked with a florescent postit?!

created elements/text nodes must be assigned to a variable, or they’ll be in JS limbo!

oh, man, I’m drowsy.

and then inserting those limbo-ing nodes into the document.

“this is why we have google, this is why o’reilly writes books, so we don’t have to memorize this stuff”

cite attribute default is “bugger-all”. indeed. nice discussion of the similarity between css & dom scripting in re: over-riding the default display of the markup.

and he shows the most powerful part of his book: the pseudocode, or as he calls it “the script, but it happens to be in English”. working through one of the examples in the book. (I wonder if you could create a paper/excel grid that would help in the “translation”)

“view rendered source” in firefox?!

Ralph notes a slight tweak in the script to make it work in IE.

back to aaron: unobtrusive == the golden rule. do unto others. the zen master approach: if they can’t accept your “help” then at least let them continue along on their business.

planning! usable w/out js. then implementation: test for methods, not browsers. (I remember that from the book. very clean.) “object literal” — keep objects and methods separate from other scripts. also, object notation. work to be generic.

I can’t quite articulate it, but I think I’m connecting the dots in my brain just a little more between my existing php expertise & this js stuff.

example, replacing a select with an unordered list to make it pretty. (theoretically.)

“everybody hates email harvesters and getting lots of pen!s email” 😉 methods for hiding. start with the normal text spelling out… bob [at] example [dot] com, but showing a real mailto link in js.

link list at the end instead of the print css effect of urls in paren after each link. this is probably one of my favorite techniques from jeremy’s book.

stripey tables. this is the one that I actually improved on from the book by using modulus instead of a counter and just getting the trs instead of getting the tables first. (you know what, though? if the table is being generated by a script — php or whatnot — then it’s a trivial task. but I do still need to hand-code the occasional table. basketball scores, mostly…okay, Don does that one. let’s say…tuition.)

resizing…different layouts by screen size. I should do this just for Teri and her jumbotron.
“man in blue” inventor of the technique, is sitting in the audience! round of applause.

if you want to bluff well, show off your stuff. little cool examples and such.

on a really large table, is there a performance hit? ppk will know. refer to quirksmode.org. somebody else mentioned increasing counter by 2 instead of by 1.

practicality of using dom vs. innerhtml? on a very complex/enterprise site, generating lots of markup, innerhtml is much faster. but if you can use cloneNode that can be fast too.

simon willison! better to create whole node and then append rather than append a bit at a time.

with greater adoption of standards, how will future deal with the performance issues? mostly, just don’t use js to create yr whole document.

will frameworks help me bluff? no and a bit yes. don’t look like a fool! need to know what you’re doing.

pointing to Shaun Inman, his scroll-to script, which aaron used in combo with flash. hmmmm…could be useful for bulletin, or catalog?

start slowly, use incrementally, and know what the hell you’re doing.

the wrapup: you can bluff in css & js, but not markup!

a clever trick for the memory-impaired

I’m terrible with names. And I want to remember who I met this weekend.

So I’m using the registrant directory and adding people I’ve met to my contact list.

The critical thing, I’m finding, is to process my photos and business card swaps asap. Otherwise, the names go in one ear and out the other.

let’s try that again

I’m theoretically awake now.? Today the hotel laundry had soap, so I’m trying to get a quick load in before my day actually gets going.? And while I wait for my clothes to wash/dry, I figured I might as well do a little writing.

Last night I got to the Ginger Man for Break Bread with Brad a little early, only I couldn’t figure out where the bread-breaking was going on.? So I sat at the bar for 20 minutes, nursing a cider and devouring spinach-artichoke dip & chips.? (mmm…it’s what’s for dinner!) Until I finally saw some younger guys with SXSW badges, also looking confused, and decided I might as well meet up with other confused people, instead of sitting by myself feeling gawky.

And yeah, the whole thing was out in the back, in a kind of yard/patio; Brad wearing his Bradlands sweatshirt, scads of people with badges.? I noticed Ralph across the crowd, and honestly: it was a relief to see a familiar face.

But as I said last night, I also made the effort to be generally sociable, go up and introduce myself to people, get into lots of new conversations.? Met: web writer from Tufts, guy who ran the company that made the flying toaster screensaver (?), a cluster of people who’ve done this a few times before, JJG, IT guy from a liberal arts college around here (wearing a utilikilt!), a woman who works for the Singapore dept. of health, and a couple of brits who work for the company that’s putting on @media.

As I said last night, I also won a book: The Kid, by Dan Savage, which I’ve sort of wanted to read for a while, plus as someone noted, it’s a local connection for me. 🙂

About the time I met the Brits was when I burnt out, and luckily one of them (Amanda) felt the same, so we shared that cab ride out to our respective hotels.

Today I’ll be playing hooky, hanging out with H, until the 3:30 sessions, when I’ll be in “Bluff your way in DOM scripting” and then probably the planning for play session. And of course tonight is the higher ed webbies dinner.

What’d’ya know?? Sitting up and writing and eating a banana seems to have woken me up most of the way.? (I love that the design on the swag bag is a banana as batteries.)? And taken up just enough time for my wash cycle to (probably) be just about done.

in a fog of not quite awake

too tired to write coherently, too awake to go to sleep.

break bread with brad was very cool, if very noisy.? met Ralph (hi!), plus a bunch of people I didn’t know at all before today.? also met JJG and was sort of fangirl-ish.? “oh, you’re Mr. Rebecca Blood!”? (his tips for SXSW? drink lots of water during the day and don’t worry too much about showing up for the first session of the morning.)

I took a bunch (? some?) pictures, which I’ll upload tomorrow.

I won a book in the prize drawing!

I had very tasty hard cider & spinach-artichoke dip.

okay, maybe I’ll go to sleep now and write more in the morning.

update

I’m going to BBwB, sans H.? (she has work again.)

today’s wandering

Back on the hotel bed watching TV. Oh, TV.

when I checked on the weather, I noticed that it’s 92 degrees right now. I honestly don’t know the last time I saw 92 degrees. That would explain why I thought I was about to heatstroke on Congress over the river.

which was why I spent a good long while in the convention center playing with legos. and chatting, being honest-to-god sociable, taking pictures, even though I was wiped-out, drenched in sweat, dressed in bike gear. one woman asked where I rented my bike, which was cool. and then I got my badge and my swag (most of which is crap, btw), and took the bus back to the hotel.

working my way back through the day…I did the south Congress thing, although the cute shops there are much like the cute shops where on Guadalupe. I’ve never seen so many size 2 clothes. but…I did pick up a couple of things at St Vincent de Paul, and after I’d pretty much given up hope, and was heading back towards downtown, stopped into a goth store. where I found some more cute light clothes (in black of course) and had a great conversation with the co-owner of the store. if you’re looking for fun goth clothes in Austin, I highly recommend Secret Oktober.

Then dropped by the bike shop, to get my seat up a little higher (quick-release was too tight!), and then back along the river. I figured originally that I’d head back to the hotel to cool off & find a laundromat, but then I remembered about the badge pickup….

which leads me back to where I started today’s travelogue. 🙂 I did discover that there’s a laundry room in the hotel, but the vending machines were out of soap. I definitely need to take care of that tomorrow or Sunday at the latest!

tonight’s plans remain vague…but whatever happens it should be fun.

the body: a virtuous cycle

This morning I saw a link from Rebecca Blood to this article on soda & obesity and it got me thinking. I had already pretty much decided to skip soda while I’m on this vacation. Now I’m certain.

Today I feel better, physically, than I have since I stopped riding regularly back in early December. And as I ride, I want things like bananas and water, instead of cookies or ice cream or soda. Which makes me feel more like stretching and such, and riding.

What that means when I get back to the land of freezing rain…I must find a way to get more exercise into my schedule. Swimming, perhaps. Either that, or I need to get really good rain gear for biking.

anticipating the day

Friday morning, the sun is shining, I’ve got a bowl of oatmeal & a banana from Whole Foods, and the day stretches ahead with no plans but my own.

I think I’m going to head to South Congress, where apparently all the cool funky shops are (plus St. Vincent de Paul!), because I am in some need of climate-appropriate and bikable clothing.

I tried Guadalupe up by UT yesterday, but it’s all for skinny little college girls, and I haven’t been one of those for a while.

If all else fails, I figured out the bus routing to the mall, where there’s a Lane Bryant. (sigh)

If H. is up for it, or if she’s working tonight, then I’ll be at Break Bread with Brad. Otherwise, I’ll be doing something else. 🙂

two happy words

replacement microwave.? and then i found the daily show.? I ain’t goin’ nowheres.

should I stay or should I go now?

I think I might stay in tonight.? I rode all over today, from the hotel to downtown to the capitol building out to UT down to Whole Foods along the river and back to the hotel.? Austin is definitely not flat.? I can sort of imagine the place as rolling hills covered with trees and grass.? But only a very few of the hills were beyond my capabilities; instead, it was a varied workout.

I’ll also at this point sing the praises of capilene.? Even when I was hot and kinda sweaty, I never felt gross.? And I can wash it in the bathroom sink, which means I didn’t have to pack as much.

So after a shower, and with H going to her 2nd job, I don’t much feel like going out to eat, and I have leftover pad thai…

On the other hand, the microwave in my room doesn’t seem to be working, so I’m off to see what I can do about it…. 🙁