[Prototype-core] Re: String.prototype.exec()

2008-03-25 Thread John-David Dalton
I have updated it with a version that reduces some overhead by using closures, thanx kangax. Yes Prototype would use Prototype.exec() instead of eval inside the ajax methods. http://dev.rubyonrails.org/ticket/11284 http://dev.rubyonrails.org/ticket/8112 I don't think this form of code

[Prototype-core] Re: String.prototype.exec()

2008-03-24 Thread kangax
Good points TJ. I was thinking about something along these lines: (Note that all features are tested when function is declared - the actual Prototype.exec only needs to go through few if blocks) (function() { var globalEvalSupported = false; window.eval('var __INCLUDE_TEST_1__ == true;');

[Prototype-core] Re: String.prototype.exec()

2008-03-24 Thread T.J. Crowder
...even though you haven't found any... s/you/the author (needed more coffee before posting) -- T.J. ;-) On Mar 24, 11:36 am, T.J. Crowder [EMAIL PROTECTED] wrote: It's an interesting implementation; would need some cleanup, IMHO. The things I see off-hand are: 1.

[Prototype-core] Re: String.prototype.exec()

2008-03-24 Thread Tobie Langel
What about something like this: http://pastie.caboo.se/169666 Best, Tobie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to

[Prototype-core] Re: String.prototype.exec()

2008-03-24 Thread Tobie Langel
Wrote about this a while ago: http://tobielangel.com/2007/2/23/to-eval-or-not-to-eval Which makes me think that a try-catch block might be useful as in: http://pastie.caboo.se/169679 Best, Tobie On Mar 24, 3:20 pm, kangax [EMAIL PROTECTED] wrote: It's great, Tobie (as always) :) The

[Prototype-core] Re: String.prototype.exec()

2008-03-24 Thread kangax
Ok, that makes sense. On the other hand, IE will catch it's proprietary execScript before ever trying script insertion (and I'm not aware of cases when execScript would not work) Do you think it's safe to just leave appendChild? - kangax On Mar 24, 10:27 am, Tobie Langel [EMAIL PROTECTED]

[Prototype-core] Re: String.prototype.exec()

2008-03-24 Thread Tobie Langel
You should be able to avoid the sniffing by using a try catch block like so: http://pastie.caboo.se/169809 On Mar 24, 7:00 pm, John-David Dalton [EMAIL PROTECTED] wrote: Missing the point a bit... The reason for the script insert in the first place is Safari has synchronous issues with eval

[Prototype-core] Re: String.prototype.exec()

2008-03-24 Thread John-David Dalton
You are right, it errors because of appending the text node. appendChild must be used to trigger the error :) Here is the modified code. http://pastie.caboo.se/169837 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[Prototype-core] Re: String.prototype.exec()

2008-03-23 Thread kangax
I actually really like the solution in one of the comments on Dean's sandbox.eval post [1]. It does no browser sniffing and degrades nicely to script insertion on browsers which don't support eval.call(window, ... ) and execScript. The check for eval can be done when prototye loads - this should