-
-
Notifications
You must be signed in to change notification settings - Fork 25
Closed
Milestone
Description
Right now, there is an issue in the handling of the window.location with regards to handling the old and incorrect, but still commonly used javascript syntax of setting the window.location to a url instead of referencing it as window.location.href = url.
Non-Working:
window.location = "/";Working:
window.location.href` = "/"Since I am unaware of a way to have a property return one datatype but accept another in the setter, n theory, using the object type as the property type the code in Window.cs could be modified from:
/// <summary>
/// Gets the location of the currently contained document.
/// </summary>
public ILocation Location
{
get { return Document.Location; }
}to the less elegant, but functional:
/// <summary>
/// Gets the location of the currently contained document.
/// </summary>
public object Location
{
get { return Document.Location; }
set
{
String locationAsUrl = value.ToString();
// probably need to validate the resulting string
if (validateUrl(locationAsUrl))
{
Document.Location.Href = locationAsUrl;
}
}
}A big weakness here is that it would require typecasting the returned object to an ILocation for any strongly typed code not using the var notation.
Your thoughts ?
Reactions are currently unavailable