Re: js code in the jsp page



On Fri, 2005-04-08 at 09:25 -0400, Colin Walters wrote:
> On Fri, 2005-04-08 at 15:19 +0200, Alexander Larsson wrote:
> > On Fri, 2005-04-08 at 09:08 -0400, Colin Walters wrote:
> > > On Fri, 2005-04-08 at 14:48 +0200, Alexander Larsson wrote:
> > > > I see that someone has moved a bunch of code related to setting the
> > > > document title to the jsp page. Any special reason for this?
> > > > 
> > > > I think we should avoid putting much code in the page itself. Its much
> > > > cleaner to separate the html from the code as much as possible.
> > > 
> > > Sure, we can separate it.  The reason it was moved is because it is very
> > > specific to the topic.jsp page.  We want to be able to use the
> > > JavaScript Topic class also for the topiclist.jsp page; there, we don't
> > > want to have references to theTopic and have it changing window.title,
> > > etc.  We could rename topic.jsp to topicdisplay.jsp or something, and
> > > move the code in it to topicdisplay.js.
> > 
> > Eh? But the topic class is specific to the topic.jsp page in many more
> > ways. Like, it accesses ids such as "closedcomments" and creates dom
> > nodes that only make sense for that page. And functions such as
> > Topic.getInterestingObjects() make no sense if you're using the topic in
> > topiclist.jsp. 
> 
> True.  I actually started on the topiclist.jsp stuff last night, and ran
> into those issues.  I was hoping we could solve them; perhaps we need
> FullTopic and TopicSummary subclasses of a general Topic class.  Or
> maybe you're right, we should just give up and create a new specific
> TopicSummary class.

I don't quite see the point in reusing it. Almost 100% of the code is
specific to its use in topic.jsp. And in the topic list you don't want
to download all the code for the topic.jsp page either. 

Thinking about this, we should probably split out the common stuff from
client.js so that this can be reused on multiple pages and thus cached.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a gun-slinging small-town sorceror on the hunt for the last specimen of a 
great and near-mythical creature. She's an orphaned mute detective from Mars. 
They fight crime! 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]