meyerweb.com

Skip to: site navigation/presentation
Skip to: Thoughts From Eric

Archive: 'Commentary' Category

No Laughing Matter

From the wise and insightful Amber Fisher, who credits The Rocket Science Group’s Voice and Tone as an inspiration:

One of the things I teach tech writers: it’s okay to have fun with your audience most of the time. But never joke with frustrated people. If you’re delivering bad news, an alert, or helping a new user troubleshoot a problem, be straightforward and transparent.

As I’m sure Amber would be the first to say, said rule is not just for tech writers.  In any online interaction, synchronous or asynchronous, with someone you don’t know really, really well, that rule applies.  Always.  And the defense “Hey, man, where’s your sense of humor?” is usually the reddest of flags that you have already screwed this up, and should consider apologizing.

(I’m especially looking at you, Twitterers.)

The Stinger

(In television, the “stinger” is the clip that plays during or just after the closing credits of a show.)

On Friday, the Web Standards Project announced its own dissolution.  I felt a lot of things upon reading the announcement, once I got over my initial surprise: nostalgia, wistfulness, closure.  And over it all, a deep sense of respect for the Project as a whole, from its inception to its peak to its final act.

In some ways, the announcement was a simple formalization of a longstanding state of affairs, as the Project has gradually grown quieter and quieter over the years, and its initiatives had been passed on to other, more active homes.  It was still impressive to see the group explicitly shut down.  I can’t think of the last time I saw a group that had been so influential and effective recognize that it was time to turn off the lights, and exit with dignity.  As they wrote:

Thanks to the hard work of countless WaSP members and supporters (like you), Tim Berners-Lee’s vision of the web as an open, accessible, and universal community is largely the reality. While there is still work to be done, the sting of the WaSP is no longer necessary. And so it is time for us to close down The Web Standards Project.

I have a long history with the WaSP.  Way, way back, deep in the thick of the browser wars, I was invited to be a member of the CSS Action Committee, better known as the CSS Samurai.  We spent the next couple of years documenting how things worked (or, more often, didn’t) in CSS implementations, and—and this was the clever bit, if you ask me—writing up specific plans of action for browsers.  The standards compliance reviews we published told browsers what they needed to fix first, not just what they were getting wrong.  I can’t claim that our every word was agreed with, let alone acted upon, but I’m pretty confident those reviews helped push browser teams in the right direction.  Or, more likely, helped browser teams push their bosses in the direction the teams already wanted to go.

Succumbing to a wave of nostalgia, I spent a few minutes trawling my archives.  I still have what I think is all the mail from the Samurai’s mailing list, run through Project Cool’s servers, from when it was set up in August 1998 up through June of 2000.  My archive totals 1,716 messages from the group, as well as some of the Steering Committee members (mostly Glenn Davis, though George Olsen was our primary contact during the Microsoft style sheets patent brouhaha of February 1999).  If I’m not reading too much into plain text messages over a decade old, we had a pretty great time.  And then, after a while, we were done.  Unlike the WaSP itself, we never really declared an end.  We didn’t even march off into the sunset having declared that the farmers always win.  We just faded away.

Not that that’s entirely a bad thing.  At a certain point, our work was done, and we moved on.  Still, I look back now and wish we’d made it a little more formal.  Had we done so, we might have said something like the WaSP did:

The job’s not over, but instead of being the work of a small activist group, it’s a job for tens of thousands of developers who care about ensuring that the web remains a free, open, interoperable, and accessible competitor to native apps and closed eco-systems. It’s your job now…

And so it is.  These last years have shown that the job is in very good hands.

“Never doubt that a small group of thoughtful, committed citizens can change the world. Indeed, it is the only thing that ever has.” said Margaret Mead.  I see now that the way those small groups truly change the world is by convincing the rest of the world that they are right, thus co-opting the world to their cause.  Done properly, the change makes the group obsolete.  It’s a lesson worth remembering, as we look at the world today.

I’m honored to have been a part of the WaSP, and I offer my deepest samurai bow of respect to its founders, its members, and its leaders.  Thank you all for making the web today what it is.

Election Day Results

[FOR PUBLICATION WEDNESDAY 7 NOVEMBER OR WHENEVER ALL THE COURT CHALLENGES ARE SETTLED]

After a campaign season that seemed even more vitriolic and interminable than any before it, America finally made its choice for President.  To many, that choice was surprising, even unthinkable.  To his supporters, of course, the win was a welcome vindication after so many difficulties and setbacks.  Between the deluge of attack ads, the debate stumbles, and the lackluster polling, it must have seemed at times as if the odds were insurmountable.  Despite all the roadblocks, however, things moved his way in the late stages, providing enough lift to secure the election.

Of course, nothing will be easy: with a divided Congress, the President will have a tough time making progress on his legislative agenda, and overseas challenges are no less acute now that the U.S. election has been settled.  The budgetary situation is still a major problem, with the “fiscal cliff” and the prospect of yet another bruising Congressional showdown looming ever larger in the country’s headlights.  The one bright spot is that—assuming the will is found to avoid plunging over the cliff—the economic recovery is likely to continue, albeit as slowly and cautiously as ever.  To a populace wearied by the campaign, any positive news will be more than welcome.

(With apologies to The Economist.)

Customizing Your Markup

So HTML5 allows you (at the moment) to create your own custom elements.  Only, not really.

(Ed. note: this post has been corrected since its publication, and a followup clarification has been posted.)

Suppose you’re creating a super-sweet JavaScript library to improve text presentation—like, say, TypeButter—and you need to insert a bunch of elements that won’t accidentally pick up pre-existing CSS.  That rules span right out the door, and anything else would be either a bad semantic match, likely to pick up CSS by mistake, or both.

Assuming you don’t want to spend the hours and lines of code necessary to push ahead with span and a whole lot of dynamic CSS rewriting, the obvious solution is to invent a new element and drop that into place.  If you’re doing kerning, then a kern element makes a lot of sense, right?  Right.  And you can certainly do that in browsers today, as well as years back.  Stuff in a new element, hit it up with some CSS, and you’re done.

Now, how does this fit with the HTML5 specification?  Not at all well.  HTML5 does not allow you to invent new elements and stuff them into your document willy-nilly.  You can’t even do it with a prefix like x-kern, because hyphens aren’t valid characters for element names (unless I read the rules incorrectly, which is always possible).

No, here’s what you do instead (corrected 10 Apr 12):

  1. Wrap your document, or at least the portion of it where you plan to use your custom markup,Define the element customization you want with an element element.  That’s not a typo.
  2. To your element element, add an extends attribute whose value is the HTML5 element you plan to extend.  We’ll use span, but you can extend any element.
  3. Now add a name attribute that names your custom “element” name, like x-kern.
  4. Okay, you’re ready!  Now anywhere you want to add a customized element, drop in the elements named by extends and then supply the name via an is attribute.

Did you follow all that?  No?  Okay, maybe this will make it a bit less unclear.  (Note: the following code block was corrected 10 Apr 12.)

<element extends="span" name="x-kern"></element>
<h1>
<span is="x-kern" style="…">A</span>
<span is="x-kern" style="…">u</span>
<span is="x-kern" style="…">t</span>
<span is="x-kern" style="…">u</span>
mn
</h1>
<p>...</p>
<p>...</p>
<p>...</p>

(Based on markup taken from the TypeButter demo page.  I simplified the inline style attributes that TypeButter generates for purposes of clarity.)

So that’s how you create “custom elements” in HTML5 as of now.  Which is to say, you don’t.  All you’re doing is attaching a label to an existing element; you’re sort of customizing an existing element, not creating a customized element.  That’s not going to help prevent CSS from being mistakenly applied to those elements.

Personally, I find this a really, really, really clumsy approach—so clumsy that I don’t think I could recommend its use.  Given that browsers will accept, render, and style arbitrary elements, I’d pretty much say to just go ahead and do it.  Do try to name your elements so they won’t run into problems later, such as prefixing them with an “x” or your username or something, but since browsers support it, may as well capitalize on their capabilities.

I’m not in the habit of saying that sort of thing lightly, either.  While I’m not the wild-eyed standards-or-be-damned radical some people think I am, I have always striven to play within the rules when possible.  Yes, there are always situations where you work counter to general best practices or even the rules, but I rarely do so lightly.  As an example, my co-founders and I went to some effort to play nice when we created the principles for Microformats, segregating our semantics into attribute values—but only because Tantek, Matt, and I cared a lot about long-term stability and validation.  We went as far as necessary to play nice, and not one millimeter further, and all the while we wished mightily for the ability to create custom attributes and elements.

Most people aren’t going to exert that much effort: they’re going to see that something works and never stop to question if what they’re doing is valid or has long-term stability.  “If the browser let me do it, it must be okay” is the background assumption that runs through our profession, and why wouldn’t it?  It’s an entirely understandable assumption to make.

We need something better.  My personal preference would be to expand the “foreign elements” definition to encompass any unrecognized element, and let the parser deal with any structural problems like lack of well-formedness.  Perhaps also expand the rules about element names to permit hyphens, so that we could do things like x-kern or emeyer-disambiguate or whatever.  I could even see my way clear to defining an way to let an author list their customized elements.  Say, something like <meta name="custom-elements" content="kern lead follow embiggen shrink"/>.  I just made that up off the top of my head, so feel free to ignore the syntax if it’s too limiting. The general concept is what’s important.

The creation of customized elements isn’t a common use case, but it’s an incredibly valuable ability, and people are going to do it.  They’re already doing it, in fact.  It’s important to figure out how to make the process of doing so simpler and more elegant.

Vigilance and Victory

After the blackout on Wednesday, it seems that the political tides are shifting against SOPA and the PROTECT IP Act—as of this writing, there are now more members of Congress in opposition to the bills than in favor.  That’s good news.

I wil reiterate something I said on Twitter, though:  the members of tech community, particularly those who are intimately familiar with the basic protocols of the Internet, need to keep working on ways to counteract SOPA/PIPA.  What form that would take, I’m not sure.  Maybe a truly distributed DNS system, one that can’t be selectively filtered by any one government or other entity.  I’m not an expert in the area, so I don’t actually know if that’s feasible.  There’s probably a much more clever solution, or better still suite of solutions.

The point is, SOPA and PIPA may soon go down to defeat, but they will return in another form.  There is too much money in the hands of those who first drafted these bills, and they’re willing to give a fair chunk of that money to those who introduced the bills in Congress.  Never mistake winning a battle with winning the war.  As someone else observed on Twitter (and I wish I could find their tweet now), the Internet community fought hard against the DMCA, and it’s been US law for more than a decade.

By all means, take a moment to applaud the widespread and effective community effort to oppose and (hopefully) defeat bad legislation.  When that’s done, take notes on what worked and what didn’t, and then prepare to fight again and harder.  Fill the gap between battles with outreach to your elected representatives and with efforts to educate the non-technical in your life to explain why SOPA/PIPA were and are a bad idea.

Days of action feel great.  Months of effort are wearying.  But it’s only the latter that can slowly and painfully bring about long-term change.

Standing In Opposition

Though I certainly do not support SOPA or the PROTECT IP Act (the complete, rather contrived acronym of PIPA), I will not be blacking out meyerweb.  This is largely because the vast majority of my readers already know about these bills, and very likely oppose them; as for anyone who visits but does not know about these bills, I feel I’ll do better to speak out than to black out.  (Which is not a criticism of those who do black out.  We all fight in our own ways.)

Instead, I will reproduce here the letter I attempted to send via contact form to my state Senator this morning, and which I will print out and send by regular postal service later today.

Senator Brown:

I grew up in Lexington, Ohio.  I moved to Cleveland in pursuit of a career, and found success.  Through a combination of good luck and hard work, I have (rather to my surprise) become a widely recognized name in my field, which is web design and development.  Along the way, I co-founded a web design conference with an even more widely respected colleague that has become one of the most respected and successful web design events in the world.  This business is headquartered in Ohio—I live in Cleveland Heights with my family, and I intend to stay here until I either retire to Florida or die.  Politically I’m best described as a moderate independent, though I do tend to lean a bit to the left.

As you can imagine, given my line of work, I have an opinion regarding the PROTECT IP Act which you have co-sponsored.  The aims of PROTECT IP are understandable, but the methods are unacceptable.  Put another way, if you wish to combat piracy and intellectual property theft, there are far better ways to go about it.

As someone with twenty years of technical experience with the Internet and nearly as many with the web—I started creating web pages in late 1993—please believe me when I say the enforcement mechanisms of the bill are deeply flawed and attack the very features of the Web that make it what it is.  They are akin to making a criminal of anyone who gives directions to a park where drug trafficking takes place, regardless of whether they knew about the drug trafficking.  You don’t have to be in favor of drug trafficking to oppose that.

This is not a case where tweaking a clause or two will fix it; correction in this case would mean starting from scratch.  Again, the objection is not with the general intent of the bill.  It is with how the bill goes about achieving those aims.

If you would like to discuss this with me further, I would be delighted to do whatever I can to help, but in any event I strongly urge you to reconsider your co-sponsorship of the PROTECT IP Act.

Thank you for your time and consideration.

Eric A. Meyer (http://meyerweb.com/)

Partner and co-founder, An Event Apart (http://aneventapart.com/)

If you agree that the PROTECT IP Act is poorly conceived, find out if your senator supports PIPA.  If they do, get in touch and let them know about your opposition.  If they oppose the bill, get in touch and thank them for their opposition.  If their support or opposition isn’t known, get in touch and ask them to please speak out in opposition to the bill.

As others have said, postal letters are better than phone calls, which are in turn better than e-mail, which is in turn better than signing petitions.  Do what you can, please.  The web site you save might be your own.

App Shopping

While I agree with Neven Mrgan’s Walled Gardens, I feel like the whole imagery of walled gardens is a bit of a metaphorical stretch—not because it’s inaccurate, but because it’s fundamentally unnecessary.  We don’t need metaphors here.

That’s because the iTunes App Store is just what its name states: it is a store.  That has a fairly specific and intentional meaning in the world of commerce.  It means that the stock is not infinite and that someone has screened it.

Think of visiting a store in the real world.  Not a small shop, but a store.  Something large (or at least largish) with lots of things to buy.  Macy’s.  Target.  Wal-Mart.  Or even the local hardware and general store in a small town, where there’s more than just tools and nails and bags of cement mix.

You go there to buy things because it’s a central location for buying a lot of things.  But inherent in the experience is that what you find on the shelves has been selected and vetted by the person or people running the store.  That doesn’t just mean favoring one brand of soap over another, but also deciding what to carry at all.  Your hardware store doesn’t sell flat-panel HDTVs.  Macy’s doesn’t stock six-inch PVC pipe.  Target doesn’t offer porn.  They have all selected some things to carry and rejected, if only implicitly, others.  Certain brands are not carried because their quality didn’t meet the proprietor’s standards, didn’t fit the store’s audience and brand, or weren’t sufficiently profitable to claim valuable shelf space.

This is an assumption about stores that we hardly notice except when it’s clearly not so.  If you’ve ever stepped into a store where it’s fairly obvious that everything, and I mean everything, the owner has ever come across in their life has been thrown onto the shelves on the theory that hell, it might look like junk but you never know what might be valuable to somebody, and you know what I mean.  We subconsciously expect that a store will offer wares which have been screened for quality and price, all conveniently collected in one place for our purchase.

So it is with the App Store.  It’s a central location for iPhone and iPad owners to go shop for apps.  The stock is large—too large for any physical store to handle—but it is still screened.  You may not like the screening criteria, just as you may not like the screening criteria exercised at Wal-Mart, but it exists nonetheless.

In the desktop computing world, of course, no such control exists.  There you find and collect applications wherever you find them, whether in a store or somewhere on the internet.  This is much the same as doing your shopping by driving around to garage sales and flea markets.  Taken as an aggregate, there’s no quality control, no screening, no organization.  It’s catch as catch can.

There’s room in the world for both models, of course.  Some people avoid stores in favor of flea markets and yard sales and the like because that’s what they prefer.  Others go to stores and avoid garage sales because they prefer the more controlled experience.  In fact, think about everyone you know.  How many prefer store shopping, and how many prefer flea market shopping?  In that light, the iTunes Store’s success is really no mystery.  It’s not just curated computing, which some have derided.  It’s curated shopping, a model which has already proven wildly popular.  More than that, it’s simple and cheap curated shopping, which is approximately the square of two wildly popular models.

You may say that there’s a significant difference between the physical world and the iTunes App Store.  If the real world were like iPhone/iPad ecosystem, there would only be one store in the whole world.  Everyone would have to shop there, and any merchant who couldn’t get in would be out of business for lack of customers.  In the real world, we can go to any store we like:  each is curated, but we can shop at the stores that offer what we like (read: that curate in a manner we find pleasing) and not the ones that don’t.  The App Store is the only place to shop.

But that’s only true if you believe that the iPhone/iPad is the only mobile ecosystem in town, which is an assumption a weirdly large number of Apple’s critics seem to make.  In fact, you’re perfectly free to join other ecosystems and shop at other stores.  Android has one, for example.  There are others.  If you don’t like what Apple offers you, then you can shop somewhere else, as many people do.

But let’s assume that you’re personally invested in the iPhone/iPad ecosystem and can’t for some reason avoid or leave it.  In that case, you’re stuck with that one single store, the App Store.

Except that’s only true because until now, nobody has launched an alternate store that offers web stack applications (WSAs).  Maybe that’s because nobody is really building WSAs yet, at least not in numbers large enough to justify building a store to sell them.  But then, maybe developers aren’t building WSAs because there’s no central place to sell them.  The centralization of stores is at least as attractive to sellers as to shoppers.  That’s a driver behind the recent announcements from Google and Mozilla, though as yet they’re just announcements.

A WSA store organized along lines similar to the App Store could do very, very well.  It would need to make the shopping and, more importantly, purchasing experiences as frictionless as possible; this is something the iTunes Store has definitely gotten right.  But suppose someone built a great WSA store and sold WSAs on a 20% commission.  How many developers might look at that and figure that the extra 10% was worth making a shift?

It certainly wouldn’t be as easy as just setting up a store and building a Scrooge McDuck vault; no, there would be many challenges, but nothing truly insurmountable.  Of that I am certain.  And the great thing is that, just like in the physical world, there’s room for multiple stores—boutique app shops, if you like.  Maybe one specializes in games; another in parent- and kid-centric apps; another in productivity apps; yet another in the “naughty” apps Apple booted out of its ecosystem a while back.  (I call them “fapps” for obvious reasons.)  Maybe these are app shops instead of app stores, but then, any large population can support a whole lot of shops.  They can coexist with any number of other stores, including those from Apple and Google and Mozilla and anyone else.

None of these WSA stores and shops would be able to sell native apps, but that’s less of an obstacle than many seem to think.  The window between native app behavior and WSA behavior has narrowed at an astonishing rate recently, and will continue to do so.  I’m not saying that you can do absolutely anything with a WSA that you can do in native code, of course, but a lot of native apps could have been done as WSAs.  Could still be done that way, in fact.

That points to the other advantage of a WSA store: it’s not limited to the iPhone/iPad ecosystem.  A well-written WSA can run in multiple ecosystems.  Being based on web technologies, they can (for the most part) go where the web goes.  The market is suddenly much bigger than the iTunes Store, much bigger than people carrying around Apple devices.  Much bigger than the people carrying around Droids, for that matter.  With WSAs, developers can sell in multiple ecosystems at once, using the most successful cross-platform technology since ones and zeros.

Besides which, in a very real sense, WSAs are not cross-platform apps.  They’re web platform apps that run in a native app that provides a window from a mobile ecosystem into the web.  We call that app a web browser, but it’s becoming more than that, and faster than many would have credited even six months ago.  The opportunities are beyond enormous.

For starters, imagine this: you have bought a number of apps at your favorite WSA store and installed them on your iPhone.  Then you find out you can finally get the hell off AT&T and move to a Verizon iPhone.  When you do that, the WSA store lets you install the apps you’ve already bought on your new ViPhone.  If it’s sufficiently smart, it will even migrate their data for you by way of the store itself.  Then, two years later, you decide you’ve had enough of Apple and want to move to another smartphone.  Once again, your apps and data go with you.

This is what the web stack makes possible.  If you thought mobile number portability was cool, imagine what you’ll think of mobile app portability.

Inspector Scrutiny

It’s been said before that web inspectors—Firebug, Dragonfly, the inspectors in Safari and Chrome, and so forth—are not always entirely accurate.  A less charitable characterization is that they lie to us, but that’s not exactly right.  The real truth is that web inspectors repeat to us the lies they are told, which are the same lies we can be told to our faces if we ask directly.

Here’s how I know this to be so:

body {font-size: medium;}

Just that.  Apply it to a test page.  Inspect the body element in any web inspector you care to fire up.  Have it tell you the computed styles for the body element.  Assuming you haven’t changed your browser’s font sizing preferences, the reported value will be 16px.

You might say that that makes sense, since an unaltered browser equates medium with “16″.  But as we saw in “Fixed Monospace Sizing“, the 16px value is not what is inherited by child elements.  What is inherited is medium, but web inspectors will never show you that as a computed style.  You can see it in the list of declared styles, which so far as I can tell lists “specific values” (as per section 6.1 of CSS2.1).  When you look to see what’s actually applied to the element in the “Computed Styles” view, you are being misled.

We can’t totally blame the inspectors, because what they list as computed styles is what they are given by the browser.  The inspectors take what the browser returns and prettify it for us, and give us ways to easily alter those values on the fly, but in the end they’re just DOM inspectors.  They don’t have a special line into the browser’s internal data.  Everything they report comes straight from the same DOM that any of us can query.  If you invoke:

var obj = document.getElementsByTagName('body')[0];
alert(getComputedStyle(obj,null).getPropertyValue('font-size'));

…on a document being given the rule I mentioned above, you will get back 16px, not medium.

This fact of inspector life was also demonstrated in “Rounding Off“.  As we saw there, browsers whose inspectors report integer pixel values also return them when queried directly from the DOM.  This despite the fact that it can be conclusively shown that those same browsers are internally storing non-integer values.

Yes, it might be possible for an inspector to do its own analysis of properties like font-size by checking the element’s specified values (which it knows) and then crawling up the document tree to do the same to all of the element’s ancestors to try to figure out a more accurate computed style.  But what bothers me is that the browser reported computed values that simply aren’t accurate in the first place.  it seems to me that they’re really “actual values”, not “computed values”, again in the sense of CSS2.1:6.1.  This makes getComputedStyle() fairly misleading as a method name; it should really be getActualStyle().

No, I don’t expect the DOM or browsers to change this, which is why it’s all the more important for us to keep these facts in mind.  Web inspectors are very powerful, useful, and convenient DOM viewers and editors, essentially souped-up interfaces to what we could collect ourselves with JavaScript.  They are thus limited by what they can get the browser to report to them.  There are steps they might take to compensate for known limitations, but that requires them to second-guess both what the browser does now and what it might do in the future.

The point, if I may be so bold, is this:  never place all your trust in what a web inspector tells you.  There may be things it cannot tell you because it does not know them, and thus what it does tell you may on occasion mislead or confuse you.  Be wary of what you are told—because even though all of it is correct, not quite all of it is true, and those are always the lies that are easiest to believe.

April 2014
SMTWTFS
March  
 12345
6789101112
13141516171819
20212223242526
27282930  

Archives

Feeds

Extras