I see - I thought you were talking about a mechanism to prevent the problem I was encountering with embedded javascript.
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Robert Koberg Sent: Friday, January 30, 2009 11:39 AM To: General Mark Logic Developer Discussion Subject: Re: [MarkLogic Dev General] embedded javascript problemconverting<to < even though I'm using a CDATA section On Jan 30, 2009, at 11:34 AM, Tim Meagher wrote: > Hi Rob, > > Where in the example below would you insert the comment? Not sure I understand. It is just for a script element where you include a js/json resource: <script src="path/to/my.js" type="text/javascript">//</script> best, -Rob > > > Thanks, > > Tim > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Robert > Koberg > Sent: Friday, January 30, 2009 11:31 AM > To: General Mark Logic Developer Discussion > Subject: Re: [MarkLogic Dev General] embedded javascript problem > converting<to < even though I'm using a CDATA section > > > On Jan 30, 2009, at 11:26 AM, Eric Palmitesta wrote: > >> Interesting! Can you explain how/why that works? > > It is just a javascript comment that keeps the element from closing :) > > >> >> >> Eric >> >> Robert Koberg wrote: >>> On Jan 30, 2009, at 11:16 AM, Tim Meagher wrote: >>>> I reckon using a separate .js file is the way to go - I especially >>>> appreciate the {' '} hint. >>> You could do away with ML processing for this type of thing if you >>> just used: >>> <script>//</script> >>> best, >>> -Rob >>>> >>>> >>>> Thanks, >>>> >>>> Tim >>>> >>>> -----Original Message----- >>>> From: [email protected] >>>> [mailto:[email protected]] On Behalf Of Eric >>>> Palmitesta >>>> Sent: Friday, January 30, 2009 11:12 AM >>>> To: General Mark Logic Developer Discussion >>>> Subject: Re: [MarkLogic Dev General] embedded javascript problem >>>> converting< >>>> to < even though I'm using a CDATA section >>>> >>>> I ran into similar problems with in-script and in-line javascript >>>> in >>>> xquery pages, but all problems were mitigated by relocating all JS >>>> code >>>> to *.js files and referencing them via <script type="text/ >>>> javascript" >>>> src="file.js">{' '}</script>, leaving only simple JS function >>>> calls in >>>> my xquery code. >>>> >>>> The {' '} is there between the script tags to prevent marklogic >>>> from >>>> collapsing them into <script ... />. >>>> >>>> Eric >>>> >>>> Tim Meagher wrote: >>>>> I have trying to embed some javascript in an xquery file and am >>>>> enclosing >>>>> the script in a CDATA section, but when the page renders, the >>>>> less than >>>>> operator >>>>> >>>>> < >>>>> >>>>> is getting converted to >>>>> >>>>> < >>>>> >>>>> which renders the javascript useless. Here's the javascript code >>>>> (note >>>> the >>>>> less than comparator used in for loop of the clearForm function) >>>>> embedded >>>> in >>>>> the head element: >>>>> >>>>> --------------------------------------------------------- >>>>> >>>>> <head><title>blah blah blah</title> >>>>> <script type="text/javascript"> >>>>> <![CDATA[ >>>>> var foo = function() { alert('test') }; >>>>> >>>>> function clearForm(oForm) { >>>>> var elements = oForm.elements; >>>>> oForm.reset(); >>>>> for(i=0; i<elements.length; i++) { >>>>> field_type = elements[i].type.toLowerCase(); >>>>> switch(field_type) { >>>>> case "text": >>>>> case "password": >>>>> case "textarea": >>>>> case "hidden": >>>>> elements[i].value = ""; >>>>> break; >>>>> case "radio": >>>>> case "checkbox": >>>>> if (elements[i].checked) { >>>>> elements[i].checked = false; >>>>> } >>>>> break; >>>>> case "select-one": >>>>> case "select-multi": >>>>> elements[i].selectedIndex = -1; >>>>> break; >>>>> default: >>>>> break; >>>>> } >>>>> } >>>>> } >>>>> ]]> >>>>> </script> >>>>> </head> >>>>> >>>>> --------------------------------------------------------- >>>>> >>>>> - Tim >>>>> >>>>> >>>>> _______________________________________________ >>>>> General mailing list >>>>> [email protected] >>>>> http://xqzone.com/mailman/listinfo/general >>>> _______________________________________________ >>>> General mailing list >>>> [email protected] >>>> http://xqzone.com/mailman/listinfo/general >>>> >>>> >>>> _______________________________________________ >>>> General mailing list >>>> [email protected] >>>> http://xqzone.com/mailman/listinfo/general >>> _______________________________________________ >>> General mailing list >>> [email protected] >>> http://xqzone.com/mailman/listinfo/general >> _______________________________________________ >> General mailing list >> [email protected] >> http://xqzone.com/mailman/listinfo/general > > _______________________________________________ > General mailing list > [email protected] > http://xqzone.com/mailman/listinfo/general > > > _______________________________________________ > General mailing list > [email protected] > http://xqzone.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
