sorry for the non-descriptive topic, I couldn't think of anything
better. However, I'm currently working on a project where you can
create simple webpages by adding different types of paragraphs, (eg.
Text, Image, Video) one below the other, and edit their contents, move
or delete them. Basically like this:
Im rewriting the JS and I have a little problem here; I recently read
that extending the DOM is basically a bad idea and that in Prototype 2
they will even stop that practice. Now my idea (actually) was, for a
project like this, to create classes for each paragraph-type with
methods and properties that I would extend the paragraph-DOM with. I
mean that if I had, like in the above image, three paragraphs, each
would be represented by a DIV with the class="paragraph text" or
class="paragraph video" etc. On the JS-side there would be classes
like "Text" or "Video" which would have a method that would extend
those DIVs with functions and properties necessary to edit, move or
delete that paragraph. When, for example, the user clicks on an
editlink, it simply would call its paragraph's edit-method. Everything
would be nice and clean.
But now I know, extending is bad. So I'm kinda stuck here, I don't
know how to write unobtrusive JS without writing terrible spaghetti-
esque code with lots of observers. I mean I could still organize parts
of the code in classes, but there would be a long list of observers
(eg. for clicking an edit-link) with switch-cases for the types of
paragraphs. Actually even with extending the DOM I'm not totally sure
how I would catch the edit-clicking event. As I said, I'm kind of
stuck :). Can you help me with ideas? How would you do this?
Thanks a lot,
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to
For more options, visit this group at