Skip to content

Commit d3ddcca

Browse files
committed
Started implementing XHR #14
1 parent 0878f20 commit d3ddcca

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

AngleSharp.Scripting.JavaScript/Dom/XmlHttpRequest.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public sealed class XmlHttpRequest : XmlHttpRequestEventTarget
2121
Int32 _timeout;
2222
Boolean _credentials;
2323
IResponse _response;
24+
HttpMethod _method;
25+
Url _url;
26+
Boolean _async;
2427

2528
#endregion
2629

@@ -32,7 +35,9 @@ public sealed class XmlHttpRequest : XmlHttpRequestEventTarget
3235
[DomConstructor]
3336
public XmlHttpRequest()
3437
{
35-
//TODO
38+
_async = true;
39+
_method = HttpMethod.Get;
40+
_url = null;
3641
_response = null;
3742
_readyState = RequesterState.Unsent;
3843
_credentials = false;
@@ -175,7 +180,10 @@ public void Abort()
175180
[DomName("open")]
176181
public void Open(String method, String url)
177182
{
178-
//TODO
183+
if (Enum.TryParse(method, true, out _method) == false)
184+
_method = HttpMethod.Get;
185+
186+
_url = Url.Create(url);
179187
}
180188

181189
/// <summary>
@@ -189,7 +197,11 @@ public void Open(String method, String url)
189197
[DomName("open")]
190198
public void Open(String method, String url, Boolean async, String username = null, String password = null)
191199
{
192-
//TODO
200+
Open(method, url);
201+
202+
_async = async;
203+
_url.UserName = username;
204+
_url.Password = password;
193205
}
194206

195207
/// <summary>

0 commit comments

Comments
 (0)