← Back to team overview

launchpad-dev team mailing list archive

Clarifying the difference between graceful degradation and regression

 

I was informed last night that a user with IE9 could not change the
maintainer or driver of his project. He could do so 6 months ago and
could use any IE browser. The old HTML forms still exist and they work
fine, but Lp does not permit him to know about them.

The purple squad speculated about /why/ this happened. Bugger
speculation, lets look. Holy !@#$%^! Happily Jon was at the end of his
day and was thinking about dinner, and the Australians are made of
sterner stuff; I decided it was time for a full rant.

I have not written anything this amateur since 1996:

    if (Y.UA.ie) {
        return;
    }

We test for feature support, not browsers, not operating systems. We
write normal HTML and then augment it with dynamic features supported by
the browser engine.

The inline picker code supports 3 states: HTML in the <noscript> tag,
JavaScript tag, and @#$%^-you-IE users. We have a shorter technical term
for the 3rd state: regression. The inline-pickers were retrofitted to
many pages. Most uses are retrofitings...most cases are a regression. I
reported a single bug that when fixed will fix many pages:
    https://bugs.launchpad.net/launchpad/+bug/954072

I doubt anyone can provide a specific reason why this or other code
should not be executed by all IE browsers. I suspect this embarrassing
chunk of code was cargo-culted from older code written by naive
engineers with YUI pre-release code thinking about IE 6.

I say we remove the IE discriminations from the code. We might fix half
of these bugs:
    https://bugs.launchpad.net/launchpad/+bugs?field.tag=ie
If users report new errors, we can ask for more information to
understand what our JavaScript code does wrong so that we write a proper
fix.

Actual code
--------------------------------------
<span tal:attributes="id view/content_box_id">
    <span class="yui3-activator-data-box">
      <tal:attribute replace="structure view/default_html"/>
    </span>
    <button class="lazr-btn yui3-activator-act yui3-activator-hidden">
      Edit
    </button>

    <a tal:condition="view/help_link"
       tal:attributes="href view/help_link"
       target="help"
       class="sprite maybe">&nbsp;
       <span class="invisible-link">Driver help</span>
    </a>

    <noscript tal:condition="view/can_write">
      <a tal:attributes="href view/edit_url;
                         title view/edit_title"
         class="sprite edit"></a>
      <a tal:condition="view/help_link"
         tal:attributes="href view/help_link"
         target="help"
         class="sprite maybe">&nbsp;
         <span class="invisible-link">Driver help</span>
      </a>
    </noscript>
    <div class="yui3-activator-message-box yui3-activator-hidden"></div>
</span>

<script tal:condition="view/can_write"
        tal:content="structure string:
LPJS.use('lp.app.picker', 'lp.client', function(Y) {
    if (Y.UA.ie) {
        return;
    }

    var picker_config = ${view/json_config}
    picker_config.validate_callback =
Y.lp.app.picker.public_private_warning;
    Y.on('load', function(e) {
      Y.lp.app.picker.addPickerPatcher(
        ${view/json_vocabulary_name},
        ${view/json_resource_uri},
        ${view/json_attribute},
        ${view/json_content_box_id},
        picker_config);
      }, window);
});
"/>
--------------------------------------
-- 

__C U R T I S  C.  H O V E Y___________
No matter where you go...there you are.


Follow ups