Showing posts with label prototype. Show all posts
Showing posts with label prototype. Show all posts

Wednesday, March 21, 2012

Atlas Safari compatibility layer considered harmful

Not wanting to rehash discussions in the wider community about the use of Object.prototype to extend the native JS objects (see: ), I have found the following inconsitency between the Firefox and Safari compatibility layers that I do not think is intended.

The _loadSafariCompatLayer() function appears to add 'getElementById', 'attachEvent' and 'deleteEvent' functions to every native Object of the window rather than just the HTMLElement prototype Object that it intends.

To replicate:

1. Go to http://atlas.asp.net/atlastoolkit/Accordion/Accordion.aspx in Safari and Firefox (or other Atlas using site)

2. In each enter to following in the address bar to create a new Object and then iterate through its properties:

javascript:var mytest = new Object();mytest.myprop = 'prop';for (var key in mytest){alert(key+' = '+typeof(mytest[key]))}

3. In Firefox there will be one alert with a value of 'myprop = prop'. In Safari there will be 4 alerts, including the extra function names (Tested in Safari 2.0.4 and Firefox 1.5.0.7)

I believe that this manipulation of Objects (in Safari only) is one of the reasons why developers have been having problems integrating custom code or other OS libraries (e.g. Prototype) with Atlas in Safari, and changing this will greatly simplify things.

This may be a Safari JS bug so this is cross-posted to the Surfin' Safari bug tracker here - http://bugs.webkit.org/

However I am aware that there design decisions in the compatibiility layers and I'd like to understand the reasons for adding these functions to every Object. (I'm not an ASP.NET developer, but rather supporting a commercial JS library which will probably be more commonly deployed along with Atlas/Prototype/etc.)

Liam,I have followed up on the bug you reported at <http://bugs.webkit.org/show_bug.cgi?id=11315>. My testing indicates that the issue you observed is most likely caused by the Safari "compatibility" layer in Atlas. When Safari is set to spoof as a Mozilla-based browser in its user-agent string the behaviour is as expected. Changing back to the default user-agent string causes the issue to reappear. I'm not sure where the appropriate place is to file bug reports on the Atlas JS toolkit, but I would appreciate it if you could do so. I would love to see this resolved so it doesn't negatively affect users of Safari.
We have completely redesigned the compat layer so this problem should disappear with the next release, which is imminent. Thanks for reporting this.

atlas prototypes

Is there anyway to compile an atlas prototype control without having Visual studio 2005 wWeb Application Projects?

I need a compiled version of the maskedit control.

hello.

hum...what do you mean?


I spoke with someone on the forum about using masked editing a text box on the client side.

They referred me to the maskedit control in the lastest source download of the AtlasControlToolkit.

I would rather not program any raw javascript code.

The thing is there is no compiled version just source. I progam in VWD express which they said does not support web application projects.

I do not have Visual Studio 2005 available right now. I was hoping someone might know of another way of going about it. Or even possibly compile it for me so I did not have to download and install a trial version of VS2005.


hello.

well, you can use atlas and the toolkit in web developer. the toolkit has several server controls which you can use in any page. if you go to codeplex.com and navigate to the toolkit page, you'll see that theere are 2 options: download with source code and only binaries. btw, you should download the source code: it's true that vs is aplus because you'd be able to load the complete solutoin with a single double click; however, you can still see the code with the express versions of vs and even run the sample web site.


Yes, I have download the binaries and sample website for the current release version of the atlas control toolkit.

What I am speaking of is the lastest version on the source page under the source tab. Inside the latest version of the source is a prototype folder with new control called the maskedit control which is not in the final release of the AtlasToolKit.

That is the control that I need compiled.


hello again!

well, i'm lost here...can you put the path to that file here? i've just donwloaded the toolkit from codeplex and it seems i can't find that file...


http://www.codeplex.com/SourceControl/ListDownloadableCommits.aspx?ProjectName=AtlasControlToolkit

This should be the link to the source page. Download 7697 source version.

In the directory where you unzip it go to \AtlasControlToolkit\Developement\Prototype\Components\Maskedit

This is a beta version of the new Maskedit control. This is the one that I can not find already compiled.

Jamy


Just to make sure I understand, you have some c# source you need to compile into a library and you can't because you're using visual web developer which only allows you to create and edit VS web sites. If this is the case and you simply want to generate a library, you can also install Visual C# express edition and use it to create your own C# project, and generate a library containing the source you require. Because ASP.NET server controls are nothing more than types, this shouldn't be a problem.

There are probably some things I'm not considering. For instance, I think Atlas makes heavy use of embedded web resources (via WebResource.axd) for it's controls. You're more than likely going to need to do some serious editting of their source to get everything working as an independent control. Regardless, you can generate single project C# libraries usingVisual C# Express Edition.

- James