Merge lp:~jtv/lazr-js/bug-427263-2 into lp:lazr-js

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~jtv/lazr-js/bug-427263-2
Merge into: lp:lazr-js
Diff against target: 38 lines (+11/-2)
2 files modified
examples/inlineeditor/index.html (+2/-2)
src-js/lazrjs/inlineedit/assets/editor-core.css (+9/-0)
To merge this branch: bzr merge lp:~jtv/lazr-js/bug-427263-2
Reviewer Review Type Date Requested Status
Michael Nelson (community) code Approve
Review via email: mp+14986@code.launchpad.net

Commit message

CSS-based fix for Konqueror problem with multiline inline-editor button.

To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

= Bug 427263, 2nd attempt =

This is about Konqueror not rendering the edit button for the multiline inline editor. The problem is that the button contains only a sprite (which is implemented as a background image), nothing else—and Konqueror doesn't bother rendering an <a> tag with no real content.

My previous solution was to insert a zero-width non-joiner. But that approach requires parallel fixes in lazr-js and Launchpad, with the latter fix breaking lots of tests. The breakage can be fixed, but it makes all those tests a lot uglier.

This new fix is pure CSS. Turns out Konqueror does render the <a> tag if I apply an empty content attribute to its :link and :visited pseudoclasses.

As far as I can tell, the content attribute is ignored in these pseudoclasses: http://www.w3schools.com/CSS/pr_gen_content.asp (and a quick check in Firefox concurs).

If some browser should fail to ignore it, and either it lets the content attribute override the tag's dimensions or we want something else than a sprite in the tag, then we may have to go looking for a new trick. I tested in Arora, Chromium, Firefox, Galeon, and Konqueror; most Internet Explorer versions apparently don't support the content attribute in the first place, so it's not likely to cause problems there either.

Jeroen

Revision history for this message
Michael Nelson (michael.nelson) wrote :

> = Bug 427263, 2nd attempt =
>

[snip]

> This new fix is pure CSS. Turns out Konqueror does render the <a> tag if I
> apply an empty content attribute to its :link and :visited pseudoclasses.

Nice!

>
> As far as I can tell, the content attribute is ignored in these pseudoclasses:
> http://www.w3schools.com/CSS/pr_gen_content.asp (and a quick check in Firefox
> concurs).

Changing the css to content: "randomtext" seems to show that it's *not* ignored in konqueror (at least, not on 4.3 on my machine here), but it works perfectly with the empty content.

>
> If some browser should fail to ignore it, and either it lets the content
> attribute override the tag's dimensions or we want something else than a
> sprite in the tag, then we may have to go looking for a new trick. I tested
> in Arora, Chromium, Firefox, Galeon, and Konqueror; most Internet Explorer
> versions apparently don't support the content attribute in the first place, so
> it's not likely to cause problems there either.

It would be worth checking this in IE8 (which apparently does support content when a valid DOCTYPE is set?).

Great find Jeroen!

>
>
> Jeroen

review: Approve (code)
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

> Changing the css to content: "randomtext" seems to show that it's *not*
> ignored in konqueror (at least, not on 4.3 on my machine here), but it works
> perfectly with the empty content.

How ironic. I don't see this behaviour with Arora, Chromium, Firefox, Galeon, IE6, IE7, or Safari. So as far as I can make out, only the browser that we need this workaround for assigns any meaning to it at all.

Note that that does leave out IE8. It's not on our EC2 instance! I'm trying to get volunteers to help me verify.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

> > Changing the css to content: "randomtext" seems to show that it's *not*
> > ignored in konqueror (at least, not on 4.3 on my machine here), but it works
> > perfectly with the empty content.
>
> How ironic. I don't see this behaviour with Arora, Chromium, Firefox, Galeon,
> IE6, IE7, or Safari. So as far as I can make out, only the browser that we
> need this workaround for assigns any meaning to it at all.
>
> Note that that does leave out IE8. It's not on our EC2 instance! I'm trying
> to get volunteers to help me verify.

I just got confirmation (thanks urbanape!) that the button still shows up normally in IE8. Landing.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/inlineeditor/index.html'
2--- examples/inlineeditor/index.html 2009-11-13 23:59:22 +0000
3+++ examples/inlineeditor/index.html 2009-11-18 11:20:27 +0000
4@@ -50,7 +50,7 @@
5 <div id="multi-text-editor">
6 <div class="clearfix">
7 <div class="edit-controls">
8- <a href="#edit" class="yui-editable_text-trigger edit">&zwnj;</a>
9+ <a href="#edit" class="yui-editable_text-trigger edit"></a>
10 </div>
11 <h2>Description</h2>
12 </div>
13@@ -70,7 +70,7 @@
14 <div id="multi-text-editor">
15 <div class="clearfix">
16 <div class="edit-controls">
17- <a href="#edit" class="yui-editable_text-trigger edit">&zwnj;</a>
18+ <a href="#edit" class="yui-editable_text-trigger edit"></a>
19 </div>
20 <h2>Description</h2>
21 </div>
22
23=== modified file 'src-js/lazrjs/inlineedit/assets/editor-core.css'
24--- src-js/lazrjs/inlineedit/assets/editor-core.css 2009-02-06 19:56:58 +0000
25+++ src-js/lazrjs/inlineedit/assets/editor-core.css 2009-11-18 11:20:27 +0000
26@@ -14,3 +14,12 @@
27 color: inherit;
28 font: inherit;
29 }
30+
31+/* Konqueror doesn't render the multiline editor's button if there's
32+ * no apparent content in it (the sprite we use is a background image).
33+ * This bit of CSS is meaningless, but tricks Konqueror into rendering
34+ * the button.
35+ */
36+.yui-editable_text-trigger:link, .yui-editable_text-trigger:visited {
37+ content: "";
38+}

Subscribers

People subscribed via source and target branches