Skip to content

Commit

Permalink
JimEvans: Updating IE driver's ElementFinder to only inject Sizzle if…
Browse files Browse the repository at this point in the history
… it does not exist on the page. Fixes issue SeleniumHQ#2062.

r17011
  • Loading branch information
jimevans committed May 24, 2012
1 parent b01655a commit 9e8b673
Show file tree
Hide file tree
Showing 2 changed files with 5,777 additions and 5,050 deletions.
8 changes: 4 additions & 4 deletions cpp/IEDriver/ElementFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ int ElementFinder::FindElementByCssSelector(const IECommandExecutor& executor,
return result;
}

std::wstring script_source(L"(function() { return function(){");
std::wstring script_source(L"(function() { return function(){ if (!window.Sizzle) {");
script_source += atoms::asString(atoms::SIZZLE);
script_source += L"\n";
script_source += L"}\n";
script_source += L"var root = arguments[1] ? arguments[1] : document.documentElement;";
script_source += L"if (root['querySelector']) { return root.querySelector(arguments[0]); } ";
script_source += L"var results = []; Sizzle(arguments[0], root, results);";
Expand Down Expand Up @@ -201,9 +201,9 @@ int ElementFinder::FindElementsByCssSelector(const IECommandExecutor& executor,
return result;
}

std::wstring script_source(L"(function() { return function(){");
std::wstring script_source(L"(function() { return function(){ if (!window.Sizzle) {");
script_source += atoms::asString(atoms::SIZZLE);
script_source += L"\n";
script_source += L"}\n";
script_source += L"var root = arguments[1] ? arguments[1] : document.documentElement;";
script_source += L"if (root['querySelectorAll']) { return root.querySelectorAll(arguments[0]); } ";
script_source += L"var results = []; Sizzle(arguments[0], root, results);";
Expand Down
Loading

0 comments on commit 9e8b673

Please sign in to comment.