[Wikitech-l] CSS/javascript injection for AJAX requests

2010-01-08 Thread Carl (CBM)
I noticed today that livepreview does not pick up the
dynamically-generated CSS from the SyntaxHighlight_Geshi extension.
The same problem occurs in liquidthreads: when you add a comment with
a Geshi call in it, the CSS will not be picked up when the comment is
initially saved. The first full reload of the page will pick up the
css correctly neither case.

After some investigation, this is really an issue in core and will
apply to any extension that needs to add CSS and/or javascript to the
output HTML.  To fix the bugs with livepreview, we would need some
mechanism where AJAX calls receive not only new HTML, but also new CSS
and/or javascript, and can add that CSS and javascript to the current
page without a reload.  Adding the CSS and javascript dynamically may
be tricky from a compatibility standpoint, but having library
functions in our site javascript would help with that.

I have not investigated the cause of the problem in liquidthreads.

The code in EditPage.php shows scars from similar problems, in a
commented-out call to send a list of categories back to an AJAX
preview request.

- Carl

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] CSS/javascript injection for AJAX requests

2010-01-08 Thread Paul Copperman
The styles and js are already available in the parser output in
-mHeadItems. Should be trivial to expose them through the API via
action=parse.
So I've put this on bugzilla, see
https://bugzilla.wikimedia.org/show_bug.cgi?id=22061

P.Copp

On Fri, Jan 8, 2010 at 5:42 PM, Carl (CBM) cbm.wikipe...@gmail.com wrote:
 I noticed today that livepreview does not pick up the
 dynamically-generated CSS from the SyntaxHighlight_Geshi extension.
 The same problem occurs in liquidthreads: when you add a comment with
 a Geshi call in it, the CSS will not be picked up when the comment is
 initially saved. The first full reload of the page will pick up the
 css correctly neither case.

 After some investigation, this is really an issue in core and will
 apply to any extension that needs to add CSS and/or javascript to the
 output HTML.  To fix the bugs with livepreview, we would need some
 mechanism where AJAX calls receive not only new HTML, but also new CSS
 and/or javascript, and can add that CSS and javascript to the current
 page without a reload.  Adding the CSS and javascript dynamically may
 be tricky from a compatibility standpoint, but having library
 functions in our site javascript would help with that.

 I have not investigated the cause of the problem in liquidthreads.

 The code in EditPage.php shows scars from similar problems, in a
 commented-out call to send a list of categories back to an AJAX
 preview request.

 - Carl

 ___
 Wikitech-l mailing list
 Wikitech-l@lists.wikimedia.org
 https://lists.wikimedia.org/mailman/listinfo/wikitech-l


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l