Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Object.clone( uriObject ) fails #1076

Closed
PabloCampos opened this Issue Nov 29, 2011 · 1 comment

Comments

Projects
None yet
2 participants

I've run this code using jsfiddle.net:

uri = new URI( );
alert( uri.toString( ) );
alert( Object.clone( uri ).toString( ) );

Under Chrome, works flawlessly. However, using IE8 (8.0.7601.17514, 32bit), first alert works but second one shows '[object Object]'.

Hence, using Request.JSON( { url : myURIObject , ... } ) is not possible under IE8.

Workaround would be Request.JSON( { url : myURIObject.toString( ) , ... } ).

Member

SergioCrisostomo commented Apr 26, 2014

@PabloCampos this is a old issue. I will close it now.

You probably found the solution/problem here yourself also....
The problem is that URI has a method .toString() and in the source code it looks like:

var toString = function(){
    return this.get('value');
};

So, since Objects have also a .toString() the best here is to use .get('value') which is what you have in the first alert. So the solution here would be

uri = new URI();
alert(uri.get('value'));
alert((Object.clone(uri)).get('value'));

and this works fine in IE8 also.

http://jsfiddle.net/87QWd/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment