June 10th, 2007

I've incorporated editing into the site–both traditional, link-based, and Ajax. I still need to tweak, and I imagine as people use the comments, things will break.

Both types of edits are available for each item, using the philosophy that a person may want to use a traditional edit page over an Ajax editing approach. The hypertext link for editing takes you to the full edit page, where you can also delete the comment. The Ajax approach is accessible through a 'button' added to the post using script.

I had planned on pulling my simple custom library for the background functionality, and either using JQuery, or Dean Edwards Base.dom on which to build. However, I'm concerned about the Safari problem with Dean's library, and I'm not sure that JQuery fits all my needs. What I may end up doing is pulling in Edwards' library, and creating my own custom intermediate library.

All I've done for now is create a singleton where before I had several global functions. The original approach doesn't impact on performance or cross-browser compatibility, but lots of global variables can cause problems with merged libraries. I've also made some attempts at eliminating IE memory links related to removeChild used with elements with assigned event handlers, but this still needs work.

I have one polling operation that checks to see if there are new comments after the page is loaded, and then pulls these in if found. The new comment(s) are added to the end of the list of comments in the page, with a yellow 'fade' to signal the addition. I've also added an Ajax preview, but not a non-scripted preview. Lots of real issues doing the latter with Wordpress. Mayhap someone else has a plugin for it.

Finally, I didn't incorporate OpenID. I thought about doing this, and had incorporated OpenID for comments via an existing plug-in at one point. However, OpenID is identity, not necessarily trust or ownership. My main interest is identifying the person who just made a comment and perhaps wants to edit typos–that's it. For now, I'm using a combination of cookies and IP address. It's not perfect, but it should be relatively safe, and relatively open.

If I had used OpenID, those people who did not want to get one of these, or who write anonymously wouldn't have been able to edit their comments. Contrary to popular criticism, anonymous comments do have value, at least in this space.

One big problem I ran into, and perhaps I don't understand XHTML, is that when I created the URL to edit a comment, which uses a traditional GET with two parameters, ala ?action=editcomment&comment=3333, I received a mal-formed XML error with Firefox. The page validated, and also pulled up in every other browser. Did I miss something related to XHTML with this one?

I have a lot more to do with the site, and the underlying libraries, but I'm starting the book this next week, and will have to finish the bits off as I can. I still have my graphics and photo library, and some meta/RDF stuff I want to incorporate. Once the work I've published here gets a chance to be decently tested, I'll look at packaging for other use. It's not going to be a simple plug-in, but should be able to be packaged.

update

I had forgotten to encode the ampersand in the URL for the link. The validator did not pick it up, because I also forgot that the link wouldn't show unless the application accessed it with my logged in cookie.

Yes, it was a particularly stupid error on my part. That's what's nice about XHTML: it doesn't hesitate to let you know when you've been stupid. Same as anonymous commenters. <smiley />

Comments
1
Shelley - 10:27 pm 6/10/2007

I guess I'll do first test.

After backup, of course.

2
Bud Gibson - 11:14 pm 6/10/2007

I am also testing. I do appreciate your openness to to anonymous comments, but I have seen anonymity lead to the worst abuses.

If you see nothing after this sentence, I was unable to edit.

Well, I am now editing my comment, and the fact that I have been thrown into a completely other interface is disorienting. This would be great if it could work inline.

From the UI, I'm not entirely sure how to save my edits (by clicking the "Edit Comment" button?). I will now press a few buttons.

Now, some time later and still able to edit, I think this has some real positives. My initial contact with the interface did throw me though. BTW, good move putting the save edit button on.

3
Loren - 12:45 am 6/11/2007

I'm testing, too, on NewNewsWire, which sometimes has problems dealing with comments.

You sure you don't more about me than, Google, Shelley?

This seems to work fine, though, except it changed my apostrophe to a slash for some reason?

4
ralph - 5:16 am 6/11/2007

Did I miss something related to XHTML with this one?

Ampersands have to be encoded.

5
Anon - 5:17 am 6/11/2007

You're *still* assigning to innerHTML… though it's a justifiable use case this time, the 'proper' versions would be a couple extra lines on code.
This one is particularly funny though:
item.innerHTML = xmlhttp.responseText;
Nice way to get around that silly xml business, eh. Maybe (not IE):
var n;
while (n = item.lastChild) optionalcleanup(item.removeChild(n));
item.appendChild(document.importNode(xmlhttp.responseXML.documentElement, true));

Your edit URL problem confuses me. I presume &action=editcomment?comment=3333 needs & and ? swapping. And surely you've read things like this, so know when to &amp; and when to & - so, are you setting the URL in some (innerHTML-like) scripting way that fox thinks bypasses escaping?

6
Shelley - 6:21 am 6/11/2007

Ralph, thank you for the help. That was it.

The W3C validator did not have a problem with the ampersand as it was.

Anon, thank you for the link. It provides a good checklist. No, I made a mistake with the lack of encoding. And for the innerHTML replacement. I used it because of memory leak issues with IE — which tends to have problems with removeChild, but not the use of innerHTML. As it is, I debated the use of hidden elements, as compared to generated for the textarea and buttons.

Still, yes, I don't like using innerHTML, and thank you for your suggestion.

Your advice is good, I'm not sure why you felt you had to do so anonymously. Surely you're proud of your comment, anon?

7
Anon - 6:38 am 6/11/2007

Contrary to popular criticism, anonymous comments do have value[…]

:D

8
Shelley - 6:50 am 6/11/2007

Point taken.

But allowing people to speak 'truth' anonymously, even when they do so to our discomfort, is the truest test in 'believing in free speech'.

I'm just used to techs taking 'credit' for their suggestions, no matter how they're delivered.

Thanks again.

9
Shelley - 7:11 am 6/11/2007

Loren, fixed the slash problem. Bud, thanks for your early feedback. I adjusted the UI based on this.

10
peggy - 10:13 am 6/11/2007

Tap, tap, tap. And edited for more tapping.

Great news. Edit comments is back. A favorite past-feature of the Bird.

Edit, edit, edit. Wheee!

Oh, and a starry 'delete comment', but be cautious. Got my tap shoes on, and an edit button, so hopefully won't need delete.

Cheers!

11

You might want to add (or show) the preview box via JavaScript, as otherwise it shows up (but does nothing) for those without JavaScript on.

12
Shelley - 1:38 pm 6/11/2007

Peggy, I found few people deleted their comments when they could edit their typos. Glad that you're glad it's back.

Scott, good point, and in my list now for next update.

13
Elaine - 2:52 pm 6/11/2007

::taps the mic::

is this thing on?

yeah, still on.

and in the separate window? not too bad.

14
Scott - 3:11 pm 6/11/2007

Works In Safari 3.0 beta 1 for Windows

Both the "Edit Now" and the "Edit in separate window".

Slight documentation fix or feature request depending on how you choose to fix it.

You have to click the back button twice after your edit. Once takes you back to the edit form with the previous text, the second click takes you back to the website where you hit refresh.

The alternative, the one I'd pick, is to display a message "edit saved. Refreshing back to the post in 5 4 3 2 1" with a countdown and a location.href refresh.

15
Elaine - 3:18 pm 6/11/2007

And I'm with Scott on that last request, either automagically redirecting to the post, or providing a link to it, instead of back and back again.

16
Shelley - 3:41 pm 6/11/2007

Good points on back button hiccup, and will add that to my upgrade list.

See? You're all such excellent beta testers.

17

This is stylistic feedback: I find the placement of the dashed lines confusing, even after making the mental "click" of realizing that they don't indicate a new comment.

I chalk this up to breaking convention with comment formats at other blogs… it doesn't feel "right", visually, to me.

OTOH: hooray for editing!

18

"Works In Safari 3.0 beta 1 for Windows

Both the "Edit Now" and the "Edit in separate window"."

I wonder what will happen if I try to wrap two paragraphs in one continuous italics tag?

I wonder what will happen if I use an em tag instead:

"Works In Safari 3.0 beta 1 for Windows

Both the "Edit Now" and the "Edit in separate window"."

Oh, nicely done. If I screw up, I get this error message:

"An error occurred, please check your syntax for malformed markup."

That's impressive.

I think the only thing I might ask for is some kind of roll-over reaction from the Preview button, so I can see that something is happening. As it is I keep getting the "malformed markup" error.

Okay, now I'm coming back to edit the comment that I posted. Interesting to see that whatever formatting I put in, be it an italics tag or an em tag, it is closed after one line. Nice to be able to edit that and fix it.

19
ScottM - 1:52 pm 6/14/2007

I'm a bumbler, but I'll happily try posting and editing.

Looks like it's still working fine. I wonder what'll happen if I delete my email address at this point…

20
ScottM - 1:59 pm 6/14/2007

Interestingly, this is what I tried and what happened.

I edited the former post to add a sentence asking "I wonder what will happen if I delete my email address at this point…" I then deleted the email address. It responded, saying that since my email address didn't match, I couldn't modify the comment. Aha, there it is! I just needed to refresh.

When I look up at it, above, my comment remains without anything from the editing… but with my email address apparently removed.

21
Shelley - 2:03 pm 6/14/2007

Scott, you've basically 'locked' your previous comment.

Thanks to all those who have contributed to the discussion. Comments are now closed, but you can contact the author of the post directly.