addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1launch-new-window--smalllight-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [Brooklyn-Javascript] Follow-up link to thewritestuff.js

From: mss
Sent on: Wednesday, August 24, 2011 11:37 AM
I have one correction from the talk last night, which is that we are not actually using `eval', the code splits the string passed to document.write at each script tag, and then creates a script element to which it appends either a textNode with the content (for well behaved browsers) or sets the `text' attribute of the script element prior to appending the element to the document body, relevant code is below:

    buildScriptTagFromString: function(str) {
        var keyValuePairs = this.makeKeyValuePairs(str);
        var scriptTag = document.createElement('script');
        for (var i in keyValuePairs) {
            scriptTag.setAttribute(i, keyValuePairs[i]);
        var innerHTML = str.replace(/<[Ss][Cc][Rr][Ii][Pp][Tt][^>]*>([\S\s]*?)<\/[Ss][Cc][Rr][Ii][Pp][Tt]>/g, '$1');
        if (innerHTML) {
            if (!!(window.attachEvent && !window.opera)) {
                scriptTag.text = innerHTML;
            } else {
        return scriptTag;

On Wed, Aug 24, 2011 at 7:16 AM, Dan <[address removed]> wrote:
In case anyone was interested (read: I'm going to use this excuse to send a link to everybody), thewritestuff.js that Matt mentioned at the meeting last night is available here:

We love feedback, good or bad, if you're at all interested, please let us know what you think.


Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Dan ([address removed]) from BK.js.
To learn more about Dan, visit his/her member profile
To unsubscribe or to update your mailing list settings, click here

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]


Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy