├── .gitattributes ├── .gitignore ├── .gitmodules ├── LICENSE.txt ├── README.md ├── build ├── CsQuery.Mvc.nuspec ├── CsQuery.nuspec ├── ProcessNuspec │ ├── ProcessNuspec.csproj │ ├── ProcessNuspec.sln │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ └── packages.config ├── csquery.build.bat ├── csquery.mvc.build.bat └── versions.bat ├── distribution ├── CsQuery.XML ├── CsQuery.dll └── CsQuery.pdb ├── documentation ├── README.md ├── charset-encoding.md ├── create.md ├── createfromurl.md ├── indexing-strategies.md ├── promises.md └── render.md ├── examples ├── CsQuery.MvcApp │ ├── CsQuery.MvcApp.Tests │ │ ├── AppHost.cs │ │ ├── CsQuery.MvcApp.Tests.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── TestConfig.cs │ │ └── TestMvcApp.cs │ ├── CsQuery.MvcApp.sln │ ├── CsQuery.MvcApp.vsmdi │ ├── CsQuery.MvcApp │ │ ├── Content │ │ │ ├── Site.css │ │ │ └── themes │ │ │ │ └── base │ │ │ │ ├── images │ │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ │ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ │ │ ├── ui-icons_222222_256x240.png │ │ │ │ ├── ui-icons_2e83ff_256x240.png │ │ │ │ ├── ui-icons_454545_256x240.png │ │ │ │ ├── ui-icons_888888_256x240.png │ │ │ │ └── ui-icons_cd0a0a_256x240.png │ │ │ │ ├── jquery.ui.accordion.css │ │ │ │ ├── jquery.ui.all.css │ │ │ │ ├── jquery.ui.autocomplete.css │ │ │ │ ├── jquery.ui.base.css │ │ │ │ ├── jquery.ui.button.css │ │ │ │ ├── jquery.ui.core.css │ │ │ │ ├── jquery.ui.datepicker.css │ │ │ │ ├── jquery.ui.dialog.css │ │ │ │ ├── jquery.ui.progressbar.css │ │ │ │ ├── jquery.ui.resizable.css │ │ │ │ ├── jquery.ui.selectable.css │ │ │ │ ├── jquery.ui.slider.css │ │ │ │ ├── jquery.ui.tabs.css │ │ │ │ └── jquery.ui.theme.css │ │ ├── Controllers │ │ │ ├── AccountController.cs │ │ │ ├── HomeController.cs │ │ │ └── Shared │ │ │ │ └── LayoutController.cs │ │ ├── CsQuery.MvcApp.csproj │ │ ├── CsQueryView │ │ │ ├── CsQueryController.cs │ │ │ ├── CsQueryView.cs │ │ │ ├── CsQueryViewEngine.cs │ │ │ └── ICsQueryController.cs │ │ ├── Global.asax │ │ ├── Global.asax.cs │ │ ├── Models │ │ │ └── AccountModels.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Scripts │ │ │ ├── MicrosoftAjax.debug.js │ │ │ ├── MicrosoftAjax.js │ │ │ ├── MicrosoftMvcAjax.debug.js │ │ │ ├── MicrosoftMvcAjax.js │ │ │ ├── MicrosoftMvcValidation.debug.js │ │ │ ├── MicrosoftMvcValidation.js │ │ │ ├── jquery-1.5.1-vsdoc.js │ │ │ ├── jquery-1.5.1.js │ │ │ ├── jquery-1.5.1.min.js │ │ │ ├── jquery-ui-1.8.11.js │ │ │ ├── jquery-ui-1.8.11.min.js │ │ │ ├── jquery.unobtrusive-ajax.js │ │ │ ├── jquery.unobtrusive-ajax.min.js │ │ │ ├── jquery.validate-vsdoc.js │ │ │ ├── jquery.validate.js │ │ │ ├── jquery.validate.min.js │ │ │ ├── jquery.validate.unobtrusive.js │ │ │ ├── jquery.validate.unobtrusive.min.js │ │ │ ├── modernizr-1.7.js │ │ │ └── modernizr-1.7.min.js │ │ ├── Views │ │ │ ├── Account │ │ │ │ ├── ChangePassword.cshtml │ │ │ │ ├── ChangePasswordSuccess.cshtml │ │ │ │ ├── LogOn.cshtml │ │ │ │ └── Register.cshtml │ │ │ ├── Home │ │ │ │ ├── About.cshtml │ │ │ │ └── Index.cshtml │ │ │ ├── Shared │ │ │ │ ├── Error.cshtml │ │ │ │ ├── _Layout.cshtml │ │ │ │ └── _LogOnPartial.cshtml │ │ │ ├── Web.config │ │ │ └── _ViewStart.cshtml │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ └── Web.config │ ├── Local.testsettings │ ├── README.md │ └── TraceAndTestImpact.testsettings ├── CsQuery.WebFormsApp │ ├── CsQuery.WebFormsApp.sln │ ├── CsQuery.WebFormsApp │ │ ├── CsQuery.WebFormsApp.csproj │ │ ├── CsQueryPage │ │ │ ├── CsQueryPage.cs │ │ │ ├── CsQueryUserControl.cs │ │ │ └── ICsQueryControl.cs │ │ ├── Default.aspx │ │ ├── Default.aspx.cs │ │ ├── Default.aspx.designer.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Scripts │ │ │ ├── jquery-1.4.1-vsdoc.js │ │ │ ├── jquery-1.4.1.js │ │ │ └── jquery-1.4.1.min.js │ │ ├── Styles │ │ │ ├── ie6.css │ │ │ ├── images │ │ │ │ ├── body-bg.gif │ │ │ │ ├── featured-content-bg.gif │ │ │ │ ├── footer-bg.gif │ │ │ │ └── nav-hover.gif │ │ │ └── style.css │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ ├── Web.config │ │ ├── WebUserControl1.ascx │ │ ├── WebUserControl1.ascx.cs │ │ ├── WebUserControl1.ascx.designer.cs │ │ └── packages.config │ └── README.md └── README.md └── source ├── .nuget ├── NuGet.Config ├── NuGet.targets ├── nuget.exe └── packages.config ├── CsQuery.Mvc.Tests ├── AppHost.cs ├── Controllers │ ├── BaseController.cs │ └── TestController.cs ├── CsQuery.Mvc.Tests.csproj ├── Global.asax ├── Global.asax.cs ├── Properties │ └── AssemblyInfo.cs ├── TestConfig.cs ├── TestObjects │ └── TestCsQueryController.cs ├── TestUtil.cs ├── Tests │ ├── AppHostBase.cs │ ├── HtmlHelpers.cs │ ├── Markup.cs │ └── ScriptManagerTests │ │ ├── BundleContents_Minimize.cs │ │ ├── BundleContents_NoBundle.cs │ │ ├── BundleContents_NoMinimize.cs │ │ ├── LibraryPath.cs │ │ ├── PathList.cs │ │ ├── Patterns.cs │ │ ├── ScriptCollection.cs │ │ ├── ScriptDependencies.cs │ │ ├── ScriptDependencies2.cs │ │ ├── ScriptDependenciesInvalid.cs │ │ ├── ScriptDependenciesNonLibrary.cs │ │ ├── ScriptDependenciesVersion.cs │ │ ├── ScriptHelper.cs │ │ ├── ScriptLocations.cs │ │ └── UsingOptions.cs ├── Views │ ├── Index.cshtml │ ├── Shared │ │ └── _Layout.cshtml │ ├── Test │ │ ├── Action1.cshtml │ │ ├── DepsOutsideLibraryPath.cshtml │ │ ├── Index.cshtml │ │ ├── Index2.cshtml │ │ ├── Index3.cshtml │ │ ├── Index4.cshtml │ │ ├── Index5.cshtml │ │ ├── InvalidScripts.cshtml │ │ └── UnresolvedScripts.cshtml │ ├── _ViewStart.cshtml │ └── web.config ├── app.config ├── packages.config ├── scripts │ ├── dep10.js │ ├── dep8.js │ ├── libs │ │ ├── dep1.js │ │ ├── dep2.js │ │ ├── dep2.min.js │ │ └── dep4.min.js │ ├── libs2 │ │ ├── dep3.js │ │ ├── dep4.js │ │ ├── dep5.js │ │ ├── dep6-1.2.2.js │ │ ├── dep6-1.2.3.js │ │ ├── dep7-1.4-beta.js │ │ └── subfolder │ │ │ ├── dep6-1.2.2.js │ │ │ └── dep6-1.2.3.js │ ├── sub-lib │ │ └── dep9.js │ ├── test-script-2.js │ ├── test-script-2.min.js │ ├── test-script-3.js │ ├── test-script-4.js │ ├── test-script-8.js │ ├── test-script-fail.js │ └── test-script.js └── web.config ├── CsQuery.Mvc.sln ├── CsQuery.Mvc ├── Changes.md ├── ClientScript │ ├── PathList.cs │ ├── Patterns.cs │ ├── ScriptCollection.cs │ ├── ScriptEnvironment.cs │ ├── ScriptManager.cs │ ├── ScriptParser.cs │ └── ScriptRef.cs ├── CqHtmlString.cs ├── CsQuery.Mvc.csproj ├── CsQuery.Mvc.nuspec ├── CsQueryController.cs ├── CsQueryView.cs ├── CsQueryViewEngine.cs ├── Csquery.Mvc.Signed.nuspec ├── DeferredCq.cs ├── ExtensionMethods.cs ├── Helpers.cs ├── HtmlHelpers │ ├── HtmlHelpers.cs │ └── enumScriptLocations.cs ├── ICsQueryController.cs ├── Properties │ └── AssemblyInfo.cs ├── README-ScriptManager.md ├── README.md ├── enumViewEngineOptions.cs ├── packages.config ├── readme.txt └── tools │ └── install.ps1 ├── CsQuery.PerformanceTests ├── .nuget │ ├── NuGet.Config │ ├── NuGet.exe │ └── NuGet.targets ├── CsQuery.PerformanceTests.sln ├── CsQuery.PerformanceTests │ ├── CsQuery.PerformanceTests.csproj │ ├── ExtensionMethods.cs │ ├── Performance │ │ ├── PerfCompare.cs │ │ ├── PerfComparison.cs │ │ ├── PerfData.cs │ │ ├── PerformanceTest.cs │ │ └── Tests │ │ │ ├── PerformanceShared.cs │ │ │ ├── Performance_BigDom.cs │ │ │ ├── Performance_MediumDom.cs │ │ │ └── Performance_SmallDom.cs │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── HTML Standard.htm │ │ ├── sizzle.htm │ │ └── wiki-cheese.htm │ ├── app.config │ └── packages.config ├── Packages.dgml └── README.md ├── CsQuery.Tests ├── Arrays.cs ├── AssertEx.cs ├── Core │ ├── Attributes │ │ └── Attributes.cs │ ├── Css │ │ └── Css.cs │ ├── Documents │ │ ├── Last.cs │ │ └── MultipleDocs.cs │ ├── Dom │ │ ├── DomContainer.cs │ │ ├── DomDocument.cs │ │ ├── DomElement.cs │ │ ├── DomFragment.cs │ │ ├── DomObject.cs │ │ ├── DomSelectElement.cs │ │ ├── DomText.cs │ │ ├── FormSubmittableElement.cs │ │ ├── HTMLOptionElement.cs │ │ ├── HTMLSelectElement.cs │ │ ├── InnerText.cs │ │ ├── OuterHtml.cs │ │ └── SpecialElements.cs │ ├── Index │ │ ├── IndexTests.cs │ │ └── SharedIndexTests.cs │ ├── Manipulation │ │ ├── Clone.cs │ │ ├── DomManipulation.cs │ │ └── MovingElements.cs │ ├── Methods │ │ ├── Append.cs │ │ ├── Before.cs │ │ ├── Create.cs │ │ ├── Data.cs │ │ ├── Each.cs │ │ ├── End.cs │ │ ├── First.cs │ │ ├── HasAttr.cs │ │ ├── Parents.cs │ │ ├── ParentsUntil.cs │ │ ├── Prepend.cs │ │ ├── Render.cs │ │ ├── ReplaceWith.cs │ │ ├── Slice.cs │ │ ├── Text.cs │ │ └── Width.cs │ ├── OutputFormatters │ │ └── FormatPlainText.cs │ ├── Selectors │ │ ├── AttributeSelectors.cs │ │ ├── CSS3 │ │ │ ├── Empty.cs │ │ │ ├── FirstChild.cs │ │ │ ├── FirstOfType.cs │ │ │ ├── LastChild.cs │ │ │ ├── LastOfType.cs │ │ │ ├── NthChild.cs │ │ │ ├── NthChildOfType.cs │ │ │ ├── NthLastChild.cs │ │ │ ├── NthLastOfType.cs │ │ │ ├── OnlyChild.cs │ │ │ └── OnlyOfType.cs │ │ ├── Combinators.cs │ │ ├── ContentIsNotNumeric.cs │ │ ├── Extensions.cs │ │ ├── MiscellaneousSelectors.cs │ │ ├── PseudoSelectors.cs │ │ └── jQuery │ │ │ ├── Checkbox.cs │ │ │ ├── Eq.cs │ │ │ ├── Even.cs │ │ │ ├── Header.cs │ │ │ ├── Hidden.cs │ │ │ ├── Odd.cs │ │ │ ├── Parent.cs │ │ │ └── Visible.cs │ └── WebIO │ │ ├── BasicWeb.cs │ │ ├── QueryRemoteServer.cs │ │ └── StressTests.cs ├── CsQueryTest.cs ├── Csquery.Tests.csproj ├── EquationParser │ ├── Equations.cs │ ├── Expressions.cs │ ├── Functions.cs │ └── Utility.cs ├── Examples │ ├── Tables.cs │ └── YahooParse.cs ├── ExtensionMethods.cs ├── ExtensionMethods │ ├── ExtensionMethodTests.cs │ ├── Forms.cs │ └── Xml.cs ├── HtmlParser │ ├── Button.cs │ ├── CharacterSetEncoding.cs │ ├── Classes.cs │ ├── DocType.cs │ ├── EdgeCases.cs │ ├── FormAssociatedElement.cs │ ├── FragmentContext.cs │ ├── Html5Compliance.cs │ ├── HtmlBigDomTest.cs │ ├── HtmlDomData.cs │ ├── HtmlElementFactory.cs │ ├── HtmlEncoding.cs │ ├── PreProcessing.cs │ ├── Rendering.cs │ ├── TextArea.cs │ └── TextHandling.cs ├── Implementation │ ├── ChildNodeList.cs │ ├── CombinedTextReader.cs │ ├── CssStyleDeclaration.cs │ ├── IndexQueue.cs │ └── RangeSortedDictionary.cs ├── Miscellaneous │ ├── Miscellaneous.cs │ └── Miscellaneous2.cs ├── Mocks │ ├── MockAsyncResult.cs │ ├── MockHttpWebRequest.cs │ ├── MockHttpWebResponse.cs │ └── MockWebRequestCreator.cs ├── Promises │ └── Promises.cs ├── Properties │ └── AssemblyInfo.cs ├── README.md ├── Resources │ ├── ABS - Auto Brake Service.htm │ ├── HTML Standard.htm │ ├── PupilLogin.htm │ ├── TestHtml.htm │ ├── TestHtml.textContent.txt │ ├── TestHtml2.htm │ ├── TextAreaTest.htm │ ├── arabic.htm │ ├── ebay-samsung-slow-text.htm │ ├── jquery-unit-index.htm │ ├── jquery-unit-index.textContents.txt │ ├── jsdom │ │ └── Level2 │ │ │ ├── anchor.html │ │ │ ├── anchor2.html │ │ │ ├── anchor3.html │ │ │ ├── applet.html │ │ │ ├── applet2.html │ │ │ ├── area.html │ │ │ ├── area2.html │ │ │ ├── base.html │ │ │ ├── base2.html │ │ │ ├── basefont.html │ │ │ ├── body.html │ │ │ ├── br.html │ │ │ ├── button.html │ │ │ ├── collection.html │ │ │ ├── directory.html │ │ │ ├── div.html │ │ │ ├── dl.html │ │ │ ├── document.html │ │ │ ├── element.html │ │ │ ├── fieldset.html │ │ │ ├── font.html │ │ │ ├── form.html │ │ │ ├── form2.html │ │ │ ├── form3.html │ │ │ ├── frame.html │ │ │ ├── frame2.html │ │ │ ├── frameset.html │ │ │ ├── head.html │ │ │ ├── heading.html │ │ │ ├── hr.html │ │ │ ├── html.html │ │ │ ├── iframe.html │ │ │ ├── iframe2.html │ │ │ ├── img.html │ │ │ ├── img │ │ │ ├── right.png │ │ │ └── w3c_main.png │ │ │ ├── input.html │ │ │ ├── isindex.html │ │ │ ├── js │ │ │ └── script1.js │ │ │ ├── label.html │ │ │ ├── legend.html │ │ │ ├── li.html │ │ │ ├── link.html │ │ │ ├── link2.html │ │ │ ├── map.html │ │ │ ├── menu.html │ │ │ ├── meta.html │ │ │ ├── mod.html │ │ │ ├── object.html │ │ │ ├── object2.html │ │ │ ├── olist.html │ │ │ ├── optgroup.html │ │ │ ├── option.html │ │ │ ├── optionscollection.html │ │ │ ├── paragraph.html │ │ │ ├── param.html │ │ │ ├── pre.html │ │ │ ├── quote.html │ │ │ ├── right.png │ │ │ ├── script.html │ │ │ ├── select.html │ │ │ ├── style.html │ │ │ ├── table.html │ │ │ ├── table1.html │ │ │ ├── tablecaption.html │ │ │ ├── tablecell.html │ │ │ ├── tablecol.html │ │ │ ├── tablerow.html │ │ │ ├── tablesection.html │ │ │ ├── textarea.html │ │ │ ├── title.html │ │ │ ├── ulist.html │ │ │ └── w3c_main.png │ ├── samsung-ebay-2.htm │ ├── samsung-ebay.htm │ ├── sizzle.htm │ └── wiki-cheese.htm ├── Support.cs ├── TestAssemblyConfig.cs ├── TestTests.cs ├── Utility │ ├── DictionaryObjects.cs │ ├── Extend.cs │ ├── FastActivator.cs │ ├── FromDictionary.cs │ ├── JSON.cs │ ├── JsObject.cs │ ├── Objects.cs │ ├── StringScanner.cs │ ├── Support.cs │ └── ValueInfo.cs ├── app.config ├── jQuery │ ├── Attribute.cs │ ├── Core.cs │ ├── Data.cs │ ├── Extra.cs │ ├── Manipulation.cs │ ├── Sizzle │ │ ├── AttributeSelectors.cs │ │ ├── BrokenSelectors.cs │ │ ├── ChildAndAdjacentSelectors.cs │ │ ├── ClassSelectors.cs │ │ ├── Element.cs │ │ ├── IDSelectors.cs │ │ ├── PseudoChild.cs │ │ └── SizzleTest.cs │ ├── Traversing.cs │ └── css.cs ├── jsdom │ ├── Attributes.cs │ ├── JsdomTest.cs │ └── Level2 │ │ └── Level2.cs └── packages.config ├── CsQuery.sln ├── CsQuery.vsmdi ├── CsQuery ├── CQ.cs ├── CQ_CsQuery │ ├── AttrReplace.cs │ ├── Create.cs │ ├── CreateFromUrl.cs │ ├── EnsureCsQuery.cs │ ├── FirstElement.cs │ ├── GetTableColumn.cs │ ├── HasAttr.cs │ ├── IncludeWhen.cs │ ├── KeepOne.cs │ ├── MakeRoot.cs │ ├── New.cs │ ├── Render.cs │ ├── Save.cs │ ├── SelectionHtml.cs │ ├── SetSelected.cs │ ├── Version.cs │ ├── _Constructors.cs │ └── _StaticMethods.cs ├── CQ_jQuery │ ├── Add.cs │ ├── After.cs │ ├── AndSelf.cs │ ├── Append.cs │ ├── AppendTo.cs │ ├── Attr.cs │ ├── Before.cs │ ├── Children.cs │ ├── Classes.cs │ ├── Clone.cs │ ├── Closest.cs │ ├── Contents.cs │ ├── Css.cs │ ├── Data.cs │ ├── Each.cs │ ├── Empty.cs │ ├── End.cs │ ├── Eq.cs │ ├── Extend.cs │ ├── Filter.cs │ ├── Find.cs │ ├── FirstLast.cs │ ├── Get.cs │ ├── Has.cs │ ├── Html.cs │ ├── Index.cs │ ├── Insert.cs │ ├── Is.cs │ ├── Map.cs │ ├── NextPrev.cs │ ├── Not.cs │ ├── Parent.cs │ ├── Parents.cs │ ├── ParentsUntil.cs │ ├── Prepend.cs │ ├── PrependTo.cs │ ├── Prop.cs │ ├── RemoveClass.cs │ ├── RemoveDetach.cs │ ├── ReplaceAll.cs │ ├── ReplaceWith.cs │ ├── Select.cs │ ├── ShowHideToggle.cs │ ├── Siblings.cs │ ├── Slice.cs │ ├── Text.cs │ ├── Val.cs │ ├── WidthHeight.cs │ └── Wrap.cs ├── Config.cs ├── Config │ ├── enumDomRenderingOptions.cs │ └── enumStartupOptions.cs ├── CsQuery.csproj ├── CsQuery.nuspec ├── CsQuery.snk ├── CsQueryConfig.cs ├── Csquery.Mvc.Nuspec ├── Csquery.Mvc.Signed.nuspec ├── Csquery.Signed.nuspec ├── Documentation │ ├── Architecture.md │ ├── Changes.md │ ├── DifferencesFromJQuery.md │ └── Todo.md ├── Dom │ ├── HtmlElements │ │ ├── IFormAssociatedElement.cs │ │ ├── IFormReassociateableElement.cs │ │ ├── IFormSubmittableElement.cs │ │ ├── IHTMLAnchorElement.cs │ │ ├── IHTMLButtonElement.cs │ │ ├── IHTMLFormElement.cs │ │ ├── IHTMLInputElement.cs │ │ ├── IHTMLLIElement.cs │ │ ├── IHTMLLabelElement.cs │ │ ├── IHTMLMeterElement.cs │ │ ├── IHTMLOptionElement.cs │ │ ├── IHTMLProgressElement.cs │ │ ├── IHTMLSelectElement.cs │ │ ├── IHTMLTextAreaElement.cs │ │ └── IHtmlOptionsCollection.cs │ ├── IAttributeCollection.cs │ ├── ICSSRule.cs │ ├── ICSSStyleDeclaration.cs │ ├── ICSSStyleRule.cs │ ├── ICSSStyleSheet.cs │ ├── ICssStyle.cs │ ├── IDomCData.cs │ ├── IDomComment.cs │ ├── IDomContainer.cs │ ├── IDomDocument.cs │ ├── IDomDocumentType.cs │ ├── IDomElement.cs │ ├── IDomElementSelect.cs │ ├── IDomFragment.cs │ ├── IDomInnerText.cs │ ├── IDomInvalidElement.cs │ ├── IDomNode.cs │ ├── IDomObject.cs │ ├── IDomObjectT.cs │ ├── IDomSpecialElement.cs │ ├── IDomText.cs │ ├── IHtmlOptionsCollection.cs │ ├── INodeList.cs │ ├── INodeListT.cs │ ├── Implementation │ │ ├── AttributeCollection.cs │ │ ├── AttributeCollection2.cs │ │ ├── AttributeDictionary.cs │ │ ├── CSSRule.cs │ │ ├── CSSStyleChangedArgs.cs │ │ ├── CSSStyleDeclaration.cs │ │ ├── CSSStyleRule.cs │ │ ├── CSSStyleSheet.cs │ │ ├── ChildNodeList.cs │ │ ├── CssStyle.cs │ │ ├── DomAttribute.cs │ │ ├── DomAttributes_nodict.cs │ │ ├── DomCData.cs │ │ ├── DomComment.cs │ │ ├── DomContainer.cs │ │ ├── DomDocument.cs │ │ ├── DomDocumentType.cs │ │ ├── DomElement.cs │ │ ├── DomFragment.cs │ │ ├── DomObject.cs │ │ ├── DomObjectT.cs │ │ ├── DomText.cs │ │ ├── HtmlElements │ │ │ ├── FormAssociatedElement.cs │ │ │ ├── FormReassociateableElement.cs │ │ │ ├── FormSubmittableElement.cs │ │ │ ├── HTMLAnchorElement.cs │ │ │ ├── HTMLButtonElement.cs │ │ │ ├── HTMLFormElement.cs │ │ │ ├── HTMLInputElement.cs │ │ │ ├── HTMLLIElement.cs │ │ │ ├── HTMLLabelElement.cs │ │ │ ├── HTMLMeterElement.cs │ │ │ ├── HTMLOptionElement.cs │ │ │ ├── HTMLProgressElement.cs │ │ │ ├── HTMLScriptElement.cs │ │ │ ├── HTMLSelectElement.cs │ │ │ ├── HTMLStyleElement.cs │ │ │ ├── HTMLTextAreaElement.cs │ │ │ └── HtmlOptionsCollection.cs │ │ ├── HtmlOptionsCollection.cs │ │ ├── NodeEventArgs.cs │ │ ├── NodeList.cs │ │ └── StyleSheet.cs │ ├── enumCSSRuleType.cs │ ├── enumCssStyleType.cs │ ├── enumDocType.cs │ ├── enumNodeType.cs │ ├── enumRelAnchor.cs │ └── enumRelLink.cs ├── Engine │ ├── AttributeSelectors.cs │ ├── CharacterEqualityComparer.cs │ ├── DomIndexNone.cs │ ├── DomIndexProviders.cs │ ├── DomIndexRanged.cs │ ├── DomIndexSimple.cs │ ├── Enums.cs │ ├── IDomIndex.cs │ ├── IDomIndexProvider.cs │ ├── IDomIndexQueue.cs │ ├── IDomIndexRanged.cs │ ├── IDomIndexSimple.cs │ ├── IDomIndexedNode.cs │ ├── IndexOperation.cs │ ├── MatchElement.cs │ ├── PseudoClassSelectors │ │ ├── Css │ │ │ ├── Contains.cs │ │ │ ├── FirstChild.cs │ │ │ ├── FirstOfType.cs │ │ │ ├── LastChild.cs │ │ │ ├── LastOfType.cs │ │ │ ├── Not.cs │ │ │ ├── NthChild.cs │ │ │ ├── NthChildMatcher.cs │ │ │ ├── NthChildSelector.cs │ │ │ ├── NthLastChild.cs │ │ │ ├── NthLastOfType.cs │ │ │ ├── NthOfType.cs │ │ │ ├── OnlyChild.cs │ │ │ └── OnlyOfType.cs │ │ ├── IPseudoSelector.cs │ │ ├── IPseudoSelectorChild.cs │ │ ├── IPseudoSelectorFilter.cs │ │ ├── Other │ │ │ └── Regex.cs │ │ ├── PseudoSelector.cs │ │ ├── PseudoSelectorChild.cs │ │ ├── PseudoSelectorFilter.cs │ │ ├── enumQuotingRule.cs │ │ └── jQuery │ │ │ ├── Empty.cs │ │ │ ├── Eq.cs │ │ │ ├── Even.cs │ │ │ ├── First.cs │ │ │ ├── Gt.cs │ │ │ ├── Has.cs │ │ │ ├── Header.cs │ │ │ ├── Hidden.cs │ │ │ ├── Indexed.cs │ │ │ ├── Lang.cs │ │ │ ├── Last.cs │ │ │ ├── Lt.cs │ │ │ ├── Odd.cs │ │ │ ├── Parent.cs │ │ │ └── Visible.cs │ ├── PseudoSelectors.cs │ ├── Selector.cs │ ├── SelectorClause.cs │ ├── SelectorEngine.cs │ ├── SelectorParser.cs │ └── enumDomIndexFeatures.cs ├── EquationParser │ ├── Equations.cs │ ├── IClause.cs │ ├── IEquation.cs │ ├── IEquationParser.cs │ ├── IEquationT.cs │ ├── IFunction.cs │ ├── ILiteral.cs │ ├── INativeOperation.cs │ ├── IOperand.cs │ ├── IOperation.cs │ ├── IOperator.cs │ ├── IOrderedDictionary.cs │ ├── IVariable.cs │ ├── IVariableContainer.cs │ ├── Implementation │ │ ├── Equation.cs │ │ ├── EquationParserEngine.cs │ │ ├── EquationT.cs │ │ ├── Function.cs │ │ ├── Functions │ │ │ ├── Abs.cs │ │ │ ├── Difference.cs │ │ │ ├── NativeOperation.cs │ │ │ ├── Power.cs │ │ │ ├── Product.cs │ │ │ ├── Quotient.cs │ │ │ └── Sum.cs │ │ ├── IntegerValue.cs │ │ ├── Literal.cs │ │ ├── Operand.cs │ │ ├── Operator.cs │ │ ├── OrderedDictionary.cs │ │ ├── Types.cs │ │ ├── Utils.cs │ │ ├── Variable.cs │ │ └── VariableReadEventArgs.cs │ ├── enumAssociation.cs │ └── enumOperationType.cs ├── ExtensionMethods │ ├── ExtensionMethods.cs │ ├── Forms.cs │ ├── Internal │ │ └── ExtensionMethods.cs │ └── Xml │ │ ├── CqXmlDocument.cs │ │ ├── CqXmlNode.cs │ │ ├── CqXmlNodeList.cs │ │ └── Xml.cs ├── HtmlParser │ ├── BOMReader.cs │ ├── CsQueryTreeBuilder.cs │ ├── Deprecated │ │ ├── HtmlElementFactory.cs │ │ ├── IterationData.cs │ │ ├── enumInsertionMode.cs │ │ └── enumTokenizerState.cs │ ├── ElementFactory.cs │ ├── HtmlData.cs │ ├── HtmlEncoding.cs │ ├── HtmlStyles.cs │ ├── enumHtmlParsingMode.cs │ ├── enumHtmlParsingOptions.cs │ └── enumTokenProperties.cs ├── HttpWebAdapters │ ├── IHttpWebRequest.cs │ ├── IHttpWebRequestFactory.cs │ ├── IHttpWebResponse.cs │ ├── Impl │ │ ├── BasicAuthHttpWebRequestFactory.cs │ │ ├── HttpWebRequestAdapter.cs │ │ ├── HttpWebRequestFactory.cs │ │ ├── HttpWebRequestMethod.cs │ │ └── HttpWebResponseAdapter.cs │ └── WebResponseStub.cs ├── Implementation │ ├── CombinedStream.cs │ ├── CombinedTextReader.cs │ ├── IRangeSortedDictionary.cs │ ├── IReadOnlyCollection.cs │ ├── IReadOnlyList.cs │ ├── MonoDictionary.cs │ ├── MonoSortedSet.cs │ ├── PathKeyComparer.cs │ ├── RBTree.cs │ ├── RangeSortedDictionary.cs │ ├── SelectionSet.cs │ ├── SelectionSetComparer.cs │ └── enumSelectionSetOrder.cs ├── JsObject.cs ├── Objects.cs ├── Output │ ├── FormatPlainText.cs │ ├── HtmlEncoderBase.cs │ ├── HtmlEncoderBasic.cs │ ├── HtmlEncoderFull.cs │ ├── HtmlEncoderMinimum.cs │ ├── HtmlEncoderMinimumNbsp.cs │ ├── HtmlEncoderNone.cs │ ├── HtmlEncoders.cs │ ├── IHtmlEncoder.cs │ ├── IOutputFormatter.cs │ ├── Indented.cs │ ├── OutputFormatterDefault.cs │ └── OutputFormatters.cs ├── Promises │ ├── Deferred.cs │ ├── DeferredT.cs │ ├── IPromise.cs │ ├── IPromiseT.cs │ ├── Timeout.cs │ ├── TimeoutT.cs │ ├── When.cs │ └── WhenAll.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── AssemblyInfo.cs.BASE.cs │ ├── AssemblyInfo.cs.LOCAL.cs │ └── AssemblyInfo.cs.REMOTE.cs ├── README-compilation.md ├── Resources │ └── css3.xml ├── StringScanner │ ├── CharacterData.cs │ ├── ExtensionMethods.cs │ ├── ICharacterInfo.cs │ ├── IExpectPattern.cs │ ├── IStringInfo.cs │ ├── IStringScanner.cs │ ├── IValueInfo.cs │ ├── IValueInfoT.cs │ ├── Implementation │ │ ├── CharacterInfo.cs │ │ ├── ExpectPattern.cs │ │ ├── StringInfo.cs │ │ └── StringScannerEngine.cs │ ├── MatchFunctions.cs │ ├── Patterns │ │ ├── Bounded.cs │ │ ├── CssClassName.cs │ │ ├── EscapedString.cs │ │ ├── HTMLAttributeName.cs │ │ ├── HTMLTagSelectorName.cs │ │ ├── HtmlID.cs │ │ ├── HtmlIDSelector.cs │ │ ├── Number.cs │ │ ├── OptionallyQuoted.cs │ │ └── Quoted.cs │ ├── Scanner.cs │ └── enumCharacterType.cs ├── Trewtech.pfx ├── Utility │ ├── Browser.cs │ ├── FastActivator.cs │ ├── JSON.cs │ ├── JsonSerializer │ │ ├── IJsonSerializer.cs │ │ └── JsonSerializer.cs │ ├── SelectorCache.cs │ ├── Support.cs │ └── Types.cs └── Web │ ├── AsyncPostbackData.cs │ ├── AsyncWebRequest.cs │ ├── AsyncWebRequestManager.cs │ ├── CsQueryHttpContext.cs │ ├── CsqWebRequest.cs │ ├── IAsyncRequestQueue.cs │ ├── ICsqWebRequest.cs │ ├── ICsqWebRequestMetadata.cs │ ├── ICsqWebResponse.cs │ ├── IWebRequestInfo.cs │ ├── ServerConfig.cs │ ├── WebForms.cs │ ├── WebRequestState.cs │ └── enumRequestState.cs ├── HTML5.md ├── Local.testsettings ├── README.md └── TraceAndTestImpact.testsettings /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs text diff=csharp 6 | *.sln text merge=union 7 | *.csproj text merge=union 8 | *.vbproj text merge=union 9 | *.fsproj text merge=union 10 | *.dbproj text merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "source/CsQuery/HtmlParserSharp"] 2 | path = source/CsQuery/HtmlParserSharp 3 | url = https://github.com/jamietre/HtmlParserSharp.git 4 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Code use license for CsQuery 2 | 3 | Copyright (c) 2012 James Treworgy 4 | 5 | LICENSE (MIT License) 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights to 10 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 11 | of the Software, and to permit persons to whom the Software is furnished to do 12 | so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 18 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 19 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /build/ProcessNuspec/ProcessNuspec.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProcessNuspec", "ProcessNuspec.csproj", "{5BDA9BDD-0808-450F-A6E3-A0A1468CAA32}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {5BDA9BDD-0808-450F-A6E3-A0A1468CAA32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {5BDA9BDD-0808-450F-A6E3-A0A1468CAA32}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {5BDA9BDD-0808-450F-A6E3-A0A1468CAA32}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {5BDA9BDD-0808-450F-A6E3-A0A1468CAA32}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /build/ProcessNuspec/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.17929 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ProcessNuspec.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /build/ProcessNuspec/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /build/ProcessNuspec/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /build/csquery.mvc.build.bat: -------------------------------------------------------------------------------- 1 | call versions 2 | 3 | mkdir NugetPackages 4 | 5 | echo Starting build 6 | 7 | .\ProcessNuspec\bin\release\ProcessNuspec.exe csquery.mvc.nuspec ..\source\CsQuery.Mvc\Csquery.Mvc.Signed.nuspec -id CsQuery.Mvc.Signed -version %csquery_mvc_version%-signed 8 | .\ProcessNuspec\bin\release\ProcessNuspec.exe csquery.mvc.nuspec ..\source\CsQuery.Mvc\Csquery.Mvc.nuspec -id CsQuery.Mvc -version %csquery_mvc_version% 9 | 10 | %msbuild% ..\source\csquery.mvc.csproj /t:clean 11 | %msbuild% ..\source\CsQuery.Mvc\csquery.mvc.csproj /p:Configuration=Release /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=..\csquery\csquery.snk 12 | nuget pack ..\source\CsQuery.Mvc\CsQuery.Mvc.Signed.nuspec -Prop Configuration=Release -Symbols -OutputDirectory "./NugetPackages" 13 | pause 14 | 15 | %msbuild% ..\source\CsQuery.Mvc\csquery.mvc.csproj /p:Configuration=Release /t:Clean 16 | %msbuild% ..\source\CsQuery.Mvc\csquery.mvc.csproj /p:Configuration=Release /p:SignAssembly=false 17 | nuget pack ..\source\CsQuery.Mvc\CsQuery.Mvc.nuspec -Prop Configuration=Release -Symbols -OutputDirectory "./NugetPackages" 18 | echo Finished 19 | pause -------------------------------------------------------------------------------- /build/versions.bat: -------------------------------------------------------------------------------- 1 | set csquery_version=1.3.5-beta5 2 | set csquery_mvc_version=1.3.11 3 | set msbuild=C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild -------------------------------------------------------------------------------- /distribution/CsQuery.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/distribution/CsQuery.dll -------------------------------------------------------------------------------- /distribution/CsQuery.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/distribution/CsQuery.pdb -------------------------------------------------------------------------------- /documentation/README.md: -------------------------------------------------------------------------------- 1 | #####CsQuery Documentation 2 | 3 | We're still a bit behind on that "web site" thing which will contain all kinds of amazing features and organized API documentation. 4 | 5 | For now I am going to try to document important features here; these files will sort the web site for content that goes beyond the API/auto-generated XML documentation. 6 | 7 | *Note: these links will not work if you are reading this from the GitHub landing page. Click "readme.md" above first. There's no way to make them work from the readme preview and the readme file itself.* 8 | 9 | - [Create](create.md) - loading from local content (a stream, file, or string) 10 | - [CreateFromUrl](createfromurl.md) - loading from the web 11 | - [Promises](promises.md) - a programming device for simplifying asynchronous callbacks 12 | - [Render](render.md) - outputting the contents of a CQ object as HTML 13 | - [Indexing Strategies](indexing-strategies.md) - choosing an indexing strategy that is optimized for your purposes 14 | -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp.Tests/TestMvcApp.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | using CsQuery.MvcApp.Controllers; 7 | 8 | namespace CsQuery.MvcApp.Tests 9 | { 10 | /// 11 | /// A very simple test showing how to test an external MVC app's output 12 | /// 13 | 14 | [TestClass] 15 | public class TestMvcApp 16 | { 17 | [TestMethod] 18 | public void VerifyStyle() 19 | { 20 | var cq = TestConfig.RenderViewCQ("index"); 21 | Assert.AreEqual("1px solid red", cq[".page"].Css("border")); 22 | 23 | 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp.vsmdi: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/jquery.ui.all.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 4 Developer Preview. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI CSS Framework 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Theming 14 | */ 15 | @import "jquery.ui.base.css"; 16 | @import "jquery.ui.theme.css"; 17 | -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/jquery.ui.base.css: -------------------------------------------------------------------------------- 1 | @import url("jquery.ui.core.css"); 2 | @import url("jquery.ui.resizable.css"); 3 | @import url("jquery.ui.selectable.css"); 4 | @import url("jquery.ui.accordion.css"); 5 | @import url("jquery.ui.autocomplete.css"); 6 | @import url("jquery.ui.button.css"); 7 | @import url("jquery.ui.dialog.css"); 8 | @import url("jquery.ui.slider.css"); 9 | @import url("jquery.ui.tabs.css"); 10 | @import url("jquery.ui.datepicker.css"); 11 | @import url("jquery.ui.progressbar.css"); -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/jquery.ui.progressbar.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 4 Developer Preview. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Progressbar 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Progressbar#theming 14 | */ 15 | .ui-progressbar { height:2em; text-align: left; } 16 | .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Content/themes/base/jquery.ui.selectable.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 4 Developer Preview. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Selectable 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Selectable#theming 14 | */ 15 | .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } 16 | -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Controllers/Shared/LayoutController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using CsQuery.Mvc; 7 | 8 | namespace CsQuery.MvcApp.Controllers 9 | { 10 | public class LayoutController : CsQueryController 11 | { 12 | 13 | 14 | public void Cq_Start() 15 | { 16 | Doc["body"].Append("
A footer. This has a red border around it because it was created before the code that adds the red border.
"); 17 | } 18 | 19 | public void Cq_End() 20 | { 21 | Doc["body"].Append("
A late-bound footer. This is the last method to execute, so there's no border.
"); 22 | } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/CsQueryView/CsQueryController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | using System.Web.Security; 8 | using CsQuery.MvcApp.Models; 9 | using CsQuery; 10 | 11 | namespace CsQuery.Mvc 12 | { 13 | /// 14 | /// Implementation of CsQuery controller 15 | /// 16 | public class CsQueryController : Controller, ICsQueryController 17 | { 18 | /// 19 | /// The CsQuery representation of the HTML before rendering. 20 | /// 21 | public CQ Doc { get; set; } 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/CsQueryView/ICsQueryController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace CsQuery.Mvc 8 | { 9 | /// 10 | /// An interface that identfies a controller as a target for CsQuery HTML processing 11 | /// 12 | public interface ICsQueryController 13 | { 14 | /// 15 | /// The CsQuery representation of the HTML before rendering. 16 | /// 17 | CQ Doc { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="CsQuery.MvcApp.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Views/Account/ChangePasswordSuccess.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Change Password"; 3 | } 4 | 5 |

Change Password

6 |

7 | Your password has been changed successfully. 8 |

9 | -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Home Page"; 3 | } 4 | 5 |

@ViewBag.Message

6 |

7 | This sample application shows you how to integrate CsQuery into an ASP.NET MVC application. It lets you intercept the HTML output and manipulate it from a view action before it's 8 | rendered. Click on the "About" tab to see a demonstration. 9 |

10 | 11 | -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model System.Web.Mvc.HandleErrorInfo 2 | 3 | @{ 4 | ViewBag.Title = "Error"; 5 | } 6 | 7 |

8 | Sorry, an error occurred while processing your request. 9 |

10 | -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | @ViewBag.Title 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 |
14 |

CsQuery/MVC Integration Demo

15 |
16 |
17 | @Html.Partial("_LogOnPartial") 18 |
19 | 25 |
26 |
27 | @RenderBody() 28 |
29 |
30 |
31 |
32 | 33 | 34 | -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Views/Shared/_LogOnPartial.cshtml: -------------------------------------------------------------------------------- 1 | 
2 | @if(Request.IsAuthenticated) { 3 | Welcome @User.Identity.Name! 4 | [ @Html.ActionLink("Log Off", "LogOff", "Account") ] 5 | } 6 | else { 7 | @:[ @Html.ActionLink("Log On", "LogOn", "Account") ] 8 | } 9 |
-------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/CsQuery.MvcApp/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/Local.testsettings: -------------------------------------------------------------------------------- 1 |  2 | 3 | These are default test settings for a local test run. 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/CsQuery.MvcApp/TraceAndTestImpact.testsettings: -------------------------------------------------------------------------------- 1 |  2 | 3 | These are test settings for Trace and Test Impact. 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/CsQuery.WebFormsApp/CsQuery.WebFormsApp/CsQueryPage/ICsQueryControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Web; 4 | using CsQuery; 5 | 6 | namespace CsQuery.AspNet 7 | { 8 | public interface ICsQueryControl 9 | { 10 | CQ Doc { get; } 11 | } 12 | } -------------------------------------------------------------------------------- /examples/CsQuery.WebFormsApp/CsQuery.WebFormsApp/Default.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Web; 4 | using System.Web.UI; 5 | using System.Web.UI.WebControls; 6 | using CsQuery.AspNet; 7 | 8 | namespace CsQuery.WebFormsApp 9 | { 10 | public partial class _Default : CsQueryPage 11 | { 12 | protected override void Cq_Render() 13 | { 14 | // Add a binding for each unconfigured link 15 | // 16 | foreach (var link in Doc["a[href='#']"]) 17 | { 18 | var innerText = link.Cq().Text(); 19 | link["href"] = String.Format("javascript:notImplemented('{0}')",innerText); 20 | }; 21 | } 22 | 23 | protected void Page_Load(object sender, EventArgs e) 24 | { 25 | 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /examples/CsQuery.WebFormsApp/CsQuery.WebFormsApp/Default.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace CsQuery.WebFormsApp { 11 | 12 | 13 | public partial class _Default { 14 | 15 | /// 16 | /// WebUserControl1 control. 17 | /// 18 | /// 19 | /// Auto-generated field. 20 | /// To modify move field declaration from designer file to code-behind file. 21 | /// 22 | protected global::CsQuery.WebFormsApp.WebUserControl1 WebUserControl1; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/CsQuery.WebFormsApp/CsQuery.WebFormsApp/Styles/ie6.css: -------------------------------------------------------------------------------- 1 | #featured-content { height: 151px; } 2 | #footer { height: 60px; } -------------------------------------------------------------------------------- /examples/CsQuery.WebFormsApp/CsQuery.WebFormsApp/Styles/images/body-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.WebFormsApp/CsQuery.WebFormsApp/Styles/images/body-bg.gif -------------------------------------------------------------------------------- /examples/CsQuery.WebFormsApp/CsQuery.WebFormsApp/Styles/images/featured-content-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.WebFormsApp/CsQuery.WebFormsApp/Styles/images/featured-content-bg.gif -------------------------------------------------------------------------------- /examples/CsQuery.WebFormsApp/CsQuery.WebFormsApp/Styles/images/footer-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.WebFormsApp/CsQuery.WebFormsApp/Styles/images/footer-bg.gif -------------------------------------------------------------------------------- /examples/CsQuery.WebFormsApp/CsQuery.WebFormsApp/Styles/images/nav-hover.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/examples/CsQuery.WebFormsApp/CsQuery.WebFormsApp/Styles/images/nav-hover.gif -------------------------------------------------------------------------------- /examples/CsQuery.WebFormsApp/CsQuery.WebFormsApp/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /examples/CsQuery.WebFormsApp/CsQuery.WebFormsApp/WebUserControl1.ascx: -------------------------------------------------------------------------------- 1 | <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="CsQuery.WebFormsApp.WebUserControl1" %> 2 | 3 | 9 | 10 |
Table with {0} rows and {1} columns.
11 | 12 | 13 |
-------------------------------------------------------------------------------- /examples/CsQuery.WebFormsApp/CsQuery.WebFormsApp/WebUserControl1.ascx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace CsQuery.WebFormsApp 11 | { 12 | 13 | 14 | public partial class WebUserControl1 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/CsQuery.WebFormsApp/CsQuery.WebFormsApp/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /source/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /source/.nuget/nuget.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/source/.nuget/nuget.exe -------------------------------------------------------------------------------- /source/.nuget/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Controllers/BaseController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using CsQuery.Mvc; 7 | 8 | namespace CsQuery.Mvc.Tests.Controllers 9 | { 10 | /// 11 | /// An example of a common class used as the base for all controllers to perform actions on every page 12 | /// 13 | 14 | public abstract class BaseController : CsQueryController 15 | { 16 | 17 | public virtual void Cq_Start() 18 | { 19 | Doc["footer"] 20 | .AddClass("cq-layout-start") 21 | .Append("
"); 22 | } 23 | 24 | public virtual void Cq_End() 25 | { 26 | Doc["footer"] 27 | .AddClass("cq-layout-end") 28 | .Append("
"); 29 | } 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="CsQuery.Mvc.Tests.MvcTestApp" Language="C#" %> 2 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/TestObjects/TestCsQueryController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Mvc.Tests.TestObjects 7 | { 8 | public class TestCsQueryController: CsQueryController 9 | { 10 | protected override System.Web.Mvc.ViewResult View(string viewName, string masterName, object model) 11 | { 12 | return base.View(viewName, masterName, model); 13 | } 14 | protected override System.Web.Mvc.ViewResult View(System.Web.Mvc.IView view, object model) 15 | { 16 | return base.View(view, model); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/TestUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web; 6 | using System.Security.Principal; 7 | using System.Web.Mvc; 8 | using System.Web.Routing; 9 | using System.IO; 10 | using CsQuery.ExtensionMethods.Internal; 11 | 12 | namespace CsQuery.Mvc.Tests 13 | { 14 | public class TestUtil 15 | { 16 | 17 | /// 18 | /// Like HttpContext.MapPath, except in the test context 19 | /// 20 | /// 21 | /// 22 | /// Relative path to a file 23 | /// 24 | /// 25 | /// 26 | /// A hard filesystem path 27 | /// 28 | 29 | public static string MapPath(string path) 30 | { 31 | if (path.StartsWith("~/")) 32 | { 33 | path = path.Substring(2); 34 | } 35 | else if (path.StartsWith("/")) 36 | { 37 | path = path.Substring(1); 38 | } 39 | 40 | path = path.Replace("/", "\\"); 41 | return Path.Combine(TestConfig.AppPath, path); 42 | } 43 | 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Tests/HtmlHelpers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Web.Mvc; 6 | using System.Web.Hosting; 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; 8 | using CsQuery.Mvc.Tests.Controllers; 9 | using CsQuery.Mvc; 10 | 11 | namespace CsQuery.Mvc.Tests 12 | { 13 | [TestClass] 14 | public class HtmlHelpers : AppHostBase 15 | { 16 | /// 17 | /// Ensure that HTML helper produces correct output. 18 | /// 19 | 20 | [TestMethod] 21 | public void HtmlTag() 22 | { 23 | var doc = RenderView("index"); 24 | 25 | Assert.IsTrue(doc["#test-cq-helper"].HasClass("testclass")); 26 | 27 | // Check the inner text to be sure the correct rendering method is being used 28 | Assert.AreEqual("This is the inner text",doc["#test-cq-helper"].Text()); 29 | Assert.IsTrue(doc["#test-cq-helper2"].HasClass("testclass2")); 30 | 31 | } 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Tests/ScriptManagerTests/BundleContents_Minimize.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Web; 6 | using System.Web.Mvc; 7 | using System.Web.Hosting; 8 | using System.Web.Optimization; 9 | using Microsoft.VisualStudio.TestTools.UnitTesting; 10 | using CsQuery.Mvc.Tests.Controllers; 11 | using CsQuery.Mvc; 12 | using CsQuery.ExtensionMethods.Internal; 13 | 14 | namespace CsQuery.Mvc.Tests 15 | { 16 | [TestClass] 17 | public class BundleContents_Minimize: AppHostBase 18 | { 19 | public BundleContents_Minimize() 20 | : base() 21 | { 22 | 23 | } 24 | 25 | [TestMethod] 26 | public void BundleContents() 27 | { 28 | var doc = RenderView("index"); 29 | var bundleUrl= doc["script[src^=/cqbundle]"][0]["src"]; 30 | 31 | string script = Host.BundlesContentsForUrl(bundleUrl); 32 | 33 | Assert.AreEqual("var dep3,dep1,dep2", script); 34 | 35 | } 36 | 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Tests/ScriptManagerTests/UsingOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Web; 6 | using System.Web.Mvc; 7 | using System.Web.Hosting; 8 | using System.Web.Optimization; 9 | using Microsoft.VisualStudio.TestTools.UnitTesting; 10 | using CsQuery.Mvc.Tests.Controllers; 11 | using CsQuery.Mvc; 12 | using CsQuery.ExtensionMethods.Internal; 13 | using CsQuery.Mvc.ClientScript; 14 | 15 | namespace CsQuery.Mvc.Tests 16 | { 17 | [TestClass] 18 | public class UsingOptions 19 | { 20 | 21 | [TestMethod] 22 | public void OptionParsing() 23 | { 24 | 25 | PathList list = new PathList(); 26 | list.Add("~/scripts/libs"); 27 | list.Add("~/scripts/libs2"); 28 | 29 | var coll = new ScriptCollection(new ScriptEnvironment { 30 | RelativePathRoot= "/", 31 | LibraryPath= list, 32 | MapPath = TestUtil.MapPath 33 | }); 34 | 35 | coll.AddPath("~/scripts/test-script-3.js"); 36 | 37 | Assert.AreEqual(coll.Count, 1); 38 | 39 | } 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Views/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | 3 | ViewBag.Title = "Home Page"; 4 | 5 | } 6 | 7 | 8 |

@ViewBag.Message

9 |

10 | This sample application shows you how to integrate CsQuery into an ASP.NET MVC application. It lets you intercept the HTML output and manipulate it from a view action before it's 11 | rendered. Click on the "About" tab to see a demonstration. 12 |

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | @ViewBag.Title 7 | 8 | 9 | 10 |
11 |
12 |
13 |

CsQuery.Mvc Unit Test

14 |
15 |
16 |
17 | @RenderBody() 18 |
19 |
20 |
21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Views/Test/Action1.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Test Controller Action1 Page"; 3 | } 4 | 5 |

@ViewBag.Message

6 |
7 |

8 | Action1 Page Content 9 |

10 | 11 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Views/Test/DepsOutsideLibraryPath.cshtml: -------------------------------------------------------------------------------- 1 | @using CsQuery.Mvc; 2 | 3 | @{ 4 | 5 | ViewBag.Title = "Test Controller Invalid Dependencies"; 6 | } 7 | 8 | 9 | 10 |

@ViewBag.Message

11 |
12 |

13 | This view contains a reference to a script with invalid dependencies. 14 |

15 | 16 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Views/Test/Index.cshtml: -------------------------------------------------------------------------------- 1 | @using CsQuery.Mvc; 2 | 3 | @{ 4 | 5 | ViewBag.Title = "Test Controller Home Page"; 6 | } 7 | 8 | 9 | 10 |

@ViewBag.Message

11 |
12 |

13 | Content on Index Path 14 |

15 | 16 | @Html.HtmlTag("div").AddClass("testclass").Attr("id", "test-cq-helper").Text("This is the inner text"); 17 | @Html.HtmlTag("
"); 18 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Views/Test/Index2.cshtml: -------------------------------------------------------------------------------- 1 | @using CsQuery.Mvc; 2 | 3 | @{ 4 | 5 | ViewBag.Title = "Test Index 2"; 6 | } 7 | 8 | @Html.Script("scripts/test-script-2") 9 | 10 |

@ViewBag.Message

11 |
12 |

13 | Content on Index Path 14 |

15 | 16 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Views/Test/Index3.cshtml: -------------------------------------------------------------------------------- 1 | @using CsQuery.Mvc; 2 | 3 | @{ 4 | 5 | ViewBag.Title = "Test Index 3"; 6 | } 7 | 8 | @Html.Script("scripts/test-script",ScriptLocations.Head) 9 | 10 |

@ViewBag.Message

11 |
12 |

13 | Content on Index Path 14 |

15 | 16 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Views/Test/Index4.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | 3 | ViewBag.Title = "Test Index 4"; 4 | Layout = ""; 5 | } 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | @Html.Script("~/scripts/libs2/dep5.js",new { @class="inhead" }, ScriptLocations.Head); 16 | @Html.Script("~/scripts/libs2/dep5.js",new { @class="inbody" }, ScriptLocations.Inline); 17 | 18 | 19 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Views/Test/Index5.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | 3 | ViewBag.Title = "Test Index 5"; 4 | Layout = ""; 5 | } 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Views/Test/InvalidScripts.cshtml: -------------------------------------------------------------------------------- 1 | @using CsQuery.Mvc; 2 | 3 | @{ 4 | 5 | ViewBag.Title = "Test Controller Invalid Dependencies"; 6 | } 7 | 8 | @Html.Script("scripts/test-script-fail.js") 9 | 10 |

@ViewBag.Message

11 |
12 |

13 | This view contains a reference to a script with invalid dependencies. 14 |

15 | 16 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Views/Test/UnresolvedScripts.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | 3 | ViewBag.Title = "Test Index 6"; 4 | Layout = ""; 5 | } 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/dep10.js: -------------------------------------------------------------------------------- 1 | var dep10; 2 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/dep8.js: -------------------------------------------------------------------------------- 1 | var dep8; 2 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/libs/dep1.js: -------------------------------------------------------------------------------- 1 | //using dep3 2 | var dep1; 3 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/libs/dep2.js: -------------------------------------------------------------------------------- 1 | //using dep1 2 | var dep2; 3 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/libs/dep2.min.js: -------------------------------------------------------------------------------- 1 | var dep2; -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/libs/dep4.min.js: -------------------------------------------------------------------------------- 1 | var dep4; -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/libs2/dep3.js: -------------------------------------------------------------------------------- 1 | var dep3; 2 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/libs2/dep4.js: -------------------------------------------------------------------------------- 1 | var dep4; 2 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/libs2/dep5.js: -------------------------------------------------------------------------------- 1 | // using-options nocombine random; 2 | var dep5; 3 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/libs2/dep6-1.2.2.js: -------------------------------------------------------------------------------- 1 |  2 | var dep6_1_2_2; 3 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/libs2/dep6-1.2.3.js: -------------------------------------------------------------------------------- 1 |  2 | var dep6_1_2_3; 3 | 4 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/libs2/dep7-1.4-beta.js: -------------------------------------------------------------------------------- 1 |  2 | var dep7_1_4_beta; 3 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/libs2/subfolder/dep6-1.2.2.js: -------------------------------------------------------------------------------- 1 |  2 | var dep6_1_2_2; 3 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/libs2/subfolder/dep6-1.2.3.js: -------------------------------------------------------------------------------- 1 |  2 | var dep6_1_2_3; 3 | 4 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/sub-lib/dep9.js: -------------------------------------------------------------------------------- 1 | // using ../dep8.js 2 | var dep9; 3 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/test-script-2.js: -------------------------------------------------------------------------------- 1 | // A comment 2 | 3 | /* 4 | using dep2 5 | 6 | end of dependencies */ 7 | 8 | // using dep4 9 | 10 | var test; 11 | var test2; -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/test-script-2.min.js: -------------------------------------------------------------------------------- 1 | var test;var test2; -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/test-script-3.js: -------------------------------------------------------------------------------- 1 | /* 2 | using dep5 nocombine 3 | 4 | 5 | end of dependencies */ 6 | 7 | var script3; 8 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/test-script-4.js: -------------------------------------------------------------------------------- 1 | /* 2 | using dep6-{version}.js 3 | using dep7-{version} 4 | 5 | end of dependencies */ 6 | 7 | var script4; 8 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/test-script-8.js: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | 5 | var script8; 6 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/test-script-fail.js: -------------------------------------------------------------------------------- 1 | //using dep1 2 | //using dep-nonexist 3 | 4 | var test; 5 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc.Tests/scripts/test-script.js: -------------------------------------------------------------------------------- 1 | //using dep1 2 | //using dep2 3 | 4 | var test; 5 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc/Changes.md: -------------------------------------------------------------------------------- 1 | ##CsQuery.MVC Framework Change Log 2 | 3 | * Fixed a bug in regex causing dependencies to be unresolved if on a single line comments, e.g. `/* using something */` 4 | * Optimized parsing during view rendering to only create a CQ object when the target is accessed 5 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc/HtmlHelpers/enumScriptLocations.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Mvc 7 | { 8 | /// 9 | /// Values that represent a placement for a script 10 | /// 11 | 12 | public enum ScriptLocations 13 | { 14 | /// 15 | /// The script should remain at the location it was found in the markup. 16 | /// 17 | Inline=1, 18 | /// 19 | /// The script should be moved to HEAD. 20 | /// 21 | Head=2 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc/ICsQueryController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace CsQuery.Mvc 8 | { 9 | /// 10 | /// An interface that identfies a controller as a target for CsQuery HTML processing 11 | /// 12 | public interface ICsQueryController 13 | { 14 | /// 15 | /// The CsQuery representation of the HTML before rendering. 16 | /// 17 | CQ Doc { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /source/CsQuery.Mvc/tools/install.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | $path = [System.IO.Path] 3 | $readmefile = $path::Combine($installPath, "path\to\your.file") 4 | $DTE.ItemOperations.OpenFile($readmefile) 5 | -------------------------------------------------------------------------------- /source/CsQuery.PerformanceTests/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /source/CsQuery.PerformanceTests/.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/source/CsQuery.PerformanceTests/.nuget/NuGet.exe -------------------------------------------------------------------------------- /source/CsQuery.PerformanceTests/CsQuery.PerformanceTests/ExtensionMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using HtmlAgilityPack; 6 | 7 | namespace CsQuery.PerformanceTests 8 | { 9 | public static class ExtensionMethods 10 | { 11 | public static IEnumerable OrDefault(this IEnumerable collection) 12 | { 13 | if (collection== null || collection.FirstOrDefault() == null) 14 | { 15 | return Enumerable.Empty(); 16 | } 17 | else 18 | { 19 | return collection; 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /source/CsQuery.PerformanceTests/CsQuery.PerformanceTests/Performance/PerfData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.IO; 6 | using System.Reflection; 7 | using CsQuery; 8 | using CsQuery.Utility; 9 | using HtmlAgilityPack; 10 | using Fizzler.Systems.HtmlAgilityPack; 11 | using System.Diagnostics; 12 | using CsQuery.EquationParser; 13 | 14 | namespace CsQuery.PerformanceTests 15 | { 16 | public class PerfData 17 | { 18 | public string Source { get; set; } 19 | public int Iterations { get; set; } 20 | public TimeSpan Time { get; set; } 21 | public string ErrorMessage { get; set; } 22 | 23 | public double TimeSeconds 24 | { 25 | get 26 | { 27 | return Math.Round(Time.TotalSeconds, 1); 28 | } 29 | } 30 | 31 | public double IterationsPerSecond { 32 | get { 33 | return (double)Iterations / ((double)Time.TotalMilliseconds / 1000d); 34 | } 35 | } 36 | 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/CsQuery.PerformanceTests/CsQuery.PerformanceTests/Performance/Tests/Performance_BigDom.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.IO; 6 | using System.Reflection; 7 | using CsQuery; 8 | using CsQuery.Utility; 9 | using HtmlAgilityPack; 10 | using Fizzler.Systems.HtmlAgilityPack; 11 | using System.Diagnostics; 12 | using CsQuery.EquationParser; 13 | 14 | namespace CsQuery.PerformanceTests.Tests 15 | { 16 | public class _Performance_BigDom : PerformanceShared 17 | { 18 | protected override string DocName 19 | { 20 | get 21 | { 22 | return "HTML standard"; 23 | } 24 | } 25 | 26 | protected override string DocDescription 27 | { 28 | get { return "large document (HTML Standard, about 6,000k)"; } 29 | } 30 | 31 | /// 32 | /// For the large test, we need more time since it can take 2 seconds just to load the DOM 33 | /// 34 | protected override int TestTimeSeconds 35 | { 36 | get 37 | { 38 | return 10; 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /source/CsQuery.PerformanceTests/CsQuery.PerformanceTests/Performance/Tests/Performance_MediumDom.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.IO; 6 | using System.Reflection; 7 | using CsQuery; 8 | using CsQuery.Utility; 9 | using HtmlAgilityPack; 10 | using Fizzler.Systems.HtmlAgilityPack; 11 | using System.Diagnostics; 12 | using CsQuery.EquationParser; 13 | 14 | namespace CsQuery.PerformanceTests.Tests 15 | { 16 | public class _Performance_MediumDom : PerformanceShared 17 | { 18 | protected override string DocName 19 | { 20 | get 21 | { 22 | return "wiki-cheese"; 23 | } 24 | } 25 | protected override string DocDescription 26 | { 27 | get { return "medium document (wiki-cheese, about 170k)"; } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/CsQuery.PerformanceTests/CsQuery.PerformanceTests/Performance/Tests/Performance_SmallDom.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.IO; 6 | using System.Reflection; 7 | using CsQuery; 8 | using CsQuery.Utility; 9 | using HtmlAgilityPack; 10 | using Fizzler.Systems.HtmlAgilityPack; 11 | using System.Diagnostics; 12 | using CsQuery.EquationParser; 13 | 14 | namespace CsQuery.PerformanceTests.Tests 15 | { 16 | public class _Performance_SmallDom : PerformanceShared 17 | { 18 | protected override string DocName 19 | { 20 | get 21 | { 22 | return "sizzle"; 23 | } 24 | } 25 | 26 | protected override string DocDescription 27 | { 28 | get { return "small document (sizzle, about 11k)"; } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/CsQuery.PerformanceTests/CsQuery.PerformanceTests/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /source/CsQuery.PerformanceTests/CsQuery.PerformanceTests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /source/CsQuery.PerformanceTests/Packages.dgml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 14 | 15 | -------------------------------------------------------------------------------- /source/CsQuery.PerformanceTests/README.md: -------------------------------------------------------------------------------- 1 | ## CsQuery Test Runner - What Is This? 2 | 3 | 8/8/2012 4 | 5 | This is console application that runs a series of performance tests to compare CsQuery's performance with HtmlAgilityPack + Fizzler. It will produce output in an `output` subfolder of the current exe location (or the project if running interactively). -------------------------------------------------------------------------------- /source/CsQuery.Tests/Core/Documents/Last.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Text; 6 | using System.Reflection; 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; 8 | using NUnit.Framework; 9 | using Assert = NUnit.Framework.Assert; 10 | using Description = NUnit.Framework.DescriptionAttribute; 11 | using TestContext = Microsoft.VisualStudio.TestTools.UnitTesting.TestContext; 12 | using CsQuery; 13 | using CsQuery.Utility; 14 | 15 | namespace CsQuery.Tests.Core 16 | { 17 | /// 18 | /// This method is largely covered by the jQuery tests 19 | /// 20 | 21 | public partial class Methods: CsQueryTest 22 | { 23 | 24 | [Test, TestMethod] 25 | public void Last() 26 | { 27 | 28 | var dom = TestDom("TestHtml"); 29 | 30 | Assert.AreEqual(1, dom["div"].Last().Length); 31 | Assert.AreEqual("test-show-last", dom["div"].Last().Attr("id")); 32 | 33 | Assert.AreEqual(0, dom["not-here"].Last().Length); 34 | } 35 | 36 | 37 | } 38 | } -------------------------------------------------------------------------------- /source/CsQuery.Tests/Core/Dom/DomContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | using NUnit.Framework; 7 | using Assert = NUnit.Framework.Assert; 8 | using Description = NUnit.Framework.DescriptionAttribute; 9 | using TestContext = Microsoft.VisualStudio.TestTools.UnitTesting.TestContext; 10 | using CsQuery.EquationParser; 11 | using CsQuery.EquationParser.Implementation; 12 | using CsQuery.EquationParser.Implementation.Functions; 13 | 14 | namespace CsQuery.Tests.Core.Dom 15 | { 16 | [TestFixture, TestClass] 17 | public class DomContainer 18 | { 19 | [Test, TestMethod] 20 | public void ChildNodeIndexer() 21 | { 22 | CQ dom = "
Test
"; 23 | 24 | Assert.AreEqual("DIV", dom.Document[0].NodeName); 25 | 26 | Assert.AreEqual("Test", dom.Document[0][0].NodeValue); 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Core/Dom/DomText.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | using NUnit.Framework; 7 | using Assert = NUnit.Framework.Assert; 8 | using Description = NUnit.Framework.DescriptionAttribute; 9 | using TestContext = Microsoft.VisualStudio.TestTools.UnitTesting.TestContext; 10 | using CsQuery.EquationParser; 11 | using CsQuery.EquationParser.Implementation; 12 | using CsQuery.EquationParser.Implementation.Functions; 13 | 14 | namespace CsQuery.Tests.Core.Dom 15 | { 16 | /// 17 | /// Tests to ensure that overridden property handling works for certain elements 18 | /// 19 | 20 | [TestFixture, TestClass] 21 | public class DomText: CsQueryTest 22 | { 23 | [Test, TestMethod] 24 | public void TextNullValue() 25 | { 26 | var textNode = Objects.CreateTextNode(""); 27 | Assert.AreEqual("",textNode.NodeValue); 28 | textNode.NodeValue = null; 29 | Assert.AreEqual("", textNode.NodeValue); 30 | 31 | } 32 | 33 | 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Core/Index/IndexTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | using NUnit.Framework; 7 | using Assert = NUnit.Framework.Assert; 8 | using Description = NUnit.Framework.DescriptionAttribute; 9 | using TestContext = Microsoft.VisualStudio.TestTools.UnitTesting.TestContext; 10 | using CsQuery.EquationParser; 11 | using CsQuery.EquationParser.Implementation; 12 | using CsQuery.EquationParser.Implementation.Functions; 13 | using CsQuery.Implementation; 14 | using CsQuery.Engine; 15 | 16 | namespace CsQuery.Tests.Core.Dom 17 | { 18 | [TestFixture, TestClass] 19 | public class RangedIndexTests 20 | { 21 | [Test, TestMethod] 22 | public void DomIndexRangedTests() 23 | { 24 | var indexTests = new SharedIndexTests(); 25 | indexTests.RunAllTests(); 26 | } 27 | 28 | [Test, TestMethod] 29 | public void DomIndexSimpleTests() 30 | { 31 | var indexTests = new SharedIndexTests(); 32 | indexTests.RunAllTests(); 33 | } 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Core/Methods/End.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Text; 6 | using System.Reflection; 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; 8 | using NUnit.Framework; 9 | using Assert = NUnit.Framework.Assert; 10 | using Description = NUnit.Framework.DescriptionAttribute; 11 | using TestContext = Microsoft.VisualStudio.TestTools.UnitTesting.TestContext; 12 | using CsQuery; 13 | using CsQuery.Utility; 14 | 15 | namespace CsQuery.Tests.Core 16 | { 17 | 18 | public partial class Methods: CsQueryTest 19 | { 20 | 21 | [Test, TestMethod] 22 | public void End() 23 | { 24 | 25 | var dom = TestDom("TestHtml"); 26 | 27 | var res = dom["#hlinks-user"].Find("span"); 28 | Assert.AreEqual("profile-triangle", res[0].ClassName); 29 | Assert.AreEqual("badge2", res.Find("span")[0].ClassName); 30 | Assert.AreEqual("profile-triangle", res.Find("span").End()[0].ClassName); 31 | } 32 | 33 | } 34 | } -------------------------------------------------------------------------------- /source/CsQuery.Tests/Core/Methods/First.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Text; 6 | using System.Reflection; 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; 8 | using NUnit.Framework; 9 | using Assert = NUnit.Framework.Assert; 10 | using Description = NUnit.Framework.DescriptionAttribute; 11 | using TestContext = Microsoft.VisualStudio.TestTools.UnitTesting.TestContext; 12 | using CsQuery; 13 | using CsQuery.Utility; 14 | 15 | namespace CsQuery.Tests.Core 16 | { 17 | /// 18 | /// This method is largely covered by the jQuery tests 19 | /// 20 | 21 | public partial class Methods: CsQueryTest 22 | { 23 | 24 | [Test, TestMethod] 25 | public void First() 26 | { 27 | 28 | var dom = TestDom("TestHtml"); 29 | 30 | Assert.AreEqual(1, dom["span"].First().Length); 31 | Assert.AreEqual("hlinks-user", dom["span"].First().Attr("id")); 32 | 33 | Assert.AreEqual(0, dom["not-here"].First().Length); 34 | } 35 | 36 | 37 | 38 | } 39 | } -------------------------------------------------------------------------------- /source/CsQuery.Tests/Core/Methods/Prepend.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using NUnit.Framework; 4 | using Assert = NUnit.Framework.Assert; 5 | 6 | namespace CsQuery.Tests.Core 7 | { 8 | public partial class Methods : CsQueryTest 9 | { 10 | [Test, TestMethod] 11 | public void PrependBug() 12 | { 13 | var result = CQ.CreateFragment("123").Select("b").Prepend("__").Append("__").Text(); 14 | Assert.AreEqual("__1____2____3__", result); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Core/Methods/Width.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Text; 6 | using System.Reflection; 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; 8 | using NUnit.Framework; 9 | using Assert = NUnit.Framework.Assert; 10 | using Description = NUnit.Framework.DescriptionAttribute; 11 | using TestContext = Microsoft.VisualStudio.TestTools.UnitTesting.TestContext; 12 | using CsQuery; 13 | using CsQuery.Utility; 14 | 15 | namespace CsQuery.Tests.Core 16 | { 17 | 18 | 19 | public partial class Methods: CsQueryTest 20 | { 21 | 22 | [Test, TestMethod] 23 | public void Width() 24 | { 25 | 26 | var dom = CQ.CreateFragment("
"); 27 | 28 | Assert.AreEqual(120, dom.Css("width")); 29 | dom.Width(150); 30 | 31 | Assert.AreEqual(150, dom.Css("width")); 32 | Assert.AreEqual("150px", dom.Css("width")); 33 | 34 | dom.Width("150in"); 35 | Assert.AreEqual("150in", dom.Css("width")); 36 | 37 | 38 | } 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /source/CsQuery.Tests/Core/Selectors/CSS3/Empty.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Text; 6 | using System.Reflection; 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; 8 | using NUnit.Framework; 9 | using Assert = NUnit.Framework.Assert; 10 | using CollectionAssert = NUnit.Framework.CollectionAssert; 11 | using Description = NUnit.Framework.DescriptionAttribute; 12 | using TestContext = Microsoft.VisualStudio.TestTools.UnitTesting.TestContext; 13 | using CsQuery; 14 | using CsQuery.Utility; 15 | 16 | namespace CsQuery.Tests.Core.Selectors 17 | { 18 | public partial class Css3 : PseudoSelector 19 | { 20 | [Test, TestMethod] 21 | public void Empty() 22 | { 23 | var res = Dom["span:empty"]; 24 | Assert.AreEqual(2, res.Length); 25 | CollectionAssert.AreEquivalent(res, Dom[".badge2,.badge3"]); 26 | 27 | 28 | res = Dom["body :empty"]; 29 | Assert.AreEqual(5, res.Length); 30 | 31 | res = Dom[":empty"]; 32 | Assert.AreEqual(6, res.Length, "6 total element seleced (5 in body, + title & html nopde "); 33 | } 34 | 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /source/CsQuery.Tests/Core/Selectors/CSS3/FirstChild.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using NUnit.Framework; 3 | using Assert = NUnit.Framework.Assert; 4 | using Description = NUnit.Framework.DescriptionAttribute; 5 | 6 | namespace CsQuery.Tests.Core.Selectors 7 | { 8 | public partial class Css3: PseudoSelector 9 | { 10 | [Test, TestMethod] 11 | public void FirstChild() 12 | { 13 | var res = Dom["span :first-child"]; 14 | Assert.AreEqual(4, res.Length); 15 | 16 | Assert.AreEqual("profile-triangle", res[0].ClassName); 17 | Assert.AreEqual("reputation-score", res[1].ClassName); 18 | Assert.AreEqual("badge2", res[2].ClassName); 19 | Assert.AreEqual("badge3", res[3].ClassName); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /source/CsQuery.Tests/Core/Selectors/jQuery/Checkbox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Text; 6 | using System.Reflection; 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; 8 | using NUnit.Framework; 9 | using Assert = NUnit.Framework.Assert; 10 | using CollectionAssert = NUnit.Framework.CollectionAssert; 11 | using Description = NUnit.Framework.DescriptionAttribute; 12 | using TestContext = Microsoft.VisualStudio.TestTools.UnitTesting.TestContext; 13 | using CsQuery; 14 | using CsQuery.Utility; 15 | 16 | namespace CsQuery.Tests.Core.Selectors 17 | { 18 | [TestFixture, TestClass] 19 | public partial class jQuery: PseudoSelector 20 | { 21 | [Test, TestMethod] 22 | public void Checkbox() 23 | { 24 | CQ res = Dom.Find("input:checkbox"); 25 | Assert.AreEqual(2, res.Length, "Expected to find 2 checkbox elements"); 26 | } 27 | 28 | 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /source/CsQuery.Tests/Core/Selectors/jQuery/Eq.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Text; 6 | using System.Reflection; 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; 8 | using NUnit.Framework; 9 | using Assert = NUnit.Framework.Assert; 10 | using CollectionAssert = NUnit.Framework.CollectionAssert; 11 | using Description = NUnit.Framework.DescriptionAttribute; 12 | using TestContext = Microsoft.VisualStudio.TestTools.UnitTesting.TestContext; 13 | using CsQuery; 14 | using CsQuery.Utility; 15 | 16 | namespace CsQuery.Tests.Core.Selectors 17 | { 18 | public partial class jQuery : PseudoSelector 19 | { 20 | 21 | /// 22 | /// Issue #19: error when no children 23 | /// 24 | 25 | [Test, TestMethod] 26 | public void Eq() 27 | { 28 | var res = CQ.CreateFragment(@"
29 | Billing Address 30 |
"); 31 | 32 | var k = res.Find("> label:visible:eq(0)"); 33 | 34 | Assert.AreEqual(0, k.Length); 35 | } 36 | 37 | 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /source/CsQuery.Tests/Core/Selectors/jQuery/Even.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Text; 6 | using System.Reflection; 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; 8 | using NUnit.Framework; 9 | using Assert = NUnit.Framework.Assert; 10 | using CollectionAssert = NUnit.Framework.CollectionAssert; 11 | using Description = NUnit.Framework.DescriptionAttribute; 12 | using TestContext = Microsoft.VisualStudio.TestTools.UnitTesting.TestContext; 13 | using CsQuery; 14 | using CsQuery.Utility; 15 | 16 | namespace CsQuery.Tests.Core.Selectors 17 | { 18 | public partial class jQuery : PseudoSelector 19 | { 20 | 21 | [Test, TestMethod] 22 | public void Even() 23 | { 24 | var res = Dom["#hlinks-user span:even"]; 25 | Assert.AreEqual(5, res.Length); 26 | Assert.AreEqual("profile-triangle", res[0].ClassName); 27 | Assert.AreEqual("badgecount", res[2].ClassName); 28 | } 29 | 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /source/CsQuery.Tests/Core/Selectors/jQuery/Header.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Text; 6 | using System.Reflection; 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; 8 | using NUnit.Framework; 9 | using Assert = NUnit.Framework.Assert; 10 | using CollectionAssert = NUnit.Framework.CollectionAssert; 11 | using Description = NUnit.Framework.DescriptionAttribute; 12 | using TestContext = Microsoft.VisualStudio.TestTools.UnitTesting.TestContext; 13 | using CsQuery; 14 | using CsQuery.Utility; 15 | 16 | namespace CsQuery.Tests.Core.Selectors 17 | { 18 | public partial class jQuery : PseudoSelector 19 | { 20 | 21 | [Test, TestMethod] 22 | public void Header() 23 | { 24 | var dom = TestDom("Wiki-Cheese"); 25 | 26 | CQ res = dom.Select(":header"); 27 | Assert.AreEqual(39, res.Length); 28 | } 29 | 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /source/CsQuery.Tests/Core/Selectors/jQuery/Hidden.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Text; 6 | using System.Reflection; 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; 8 | using NUnit.Framework; 9 | using Assert = NUnit.Framework.Assert; 10 | using CollectionAssert = NUnit.Framework.CollectionAssert; 11 | using Description = NUnit.Framework.DescriptionAttribute; 12 | using TestContext = Microsoft.VisualStudio.TestTools.UnitTesting.TestContext; 13 | using CsQuery; 14 | using CsQuery.Utility; 15 | 16 | namespace CsQuery.Tests.Core.Selectors 17 | { 18 | public partial class jQuery: PseudoSelector 19 | { 20 | [Test, TestMethod] 21 | public void Hidden() 22 | { 23 | var dom = VisibilityTestDom(); 24 | 25 | var res = dom.Select("div:hidden"); 26 | Assert.AreEqual(dom.Select("#outer,#outer3,#outer4,#outer6"), res, "Correct divs are visible"); 27 | 28 | res = dom.Select("span:hidden"); 29 | Assert.AreEqual(dom.Select("#inner, #inner3, #inner4"), res, "Correct spans are visible"); 30 | } 31 | 32 | 33 | 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /source/CsQuery.Tests/Core/Selectors/jQuery/Odd.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Text; 6 | using System.Reflection; 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; 8 | using NUnit.Framework; 9 | using Assert = NUnit.Framework.Assert; 10 | using CollectionAssert = NUnit.Framework.CollectionAssert; 11 | using Description = NUnit.Framework.DescriptionAttribute; 12 | using TestContext = Microsoft.VisualStudio.TestTools.UnitTesting.TestContext; 13 | using CsQuery; 14 | using CsQuery.Utility; 15 | 16 | namespace CsQuery.Tests.Core.Selectors 17 | { 18 | public partial class jQuery : PseudoSelector 19 | { 20 | 21 | [Test, TestMethod] 22 | public void Odd() 23 | { 24 | var res = Dom["#hlinks-user span:odd"]; 25 | Assert.AreEqual(4, res.Length); 26 | Assert.AreEqual("reputation-score", res[0].ClassName); 27 | Assert.AreEqual("badge2", res[1].ClassName); 28 | } 29 | 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /source/CsQuery.Tests/Mocks/MockAsyncResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Tests.Mocks 7 | { 8 | public class MockAsyncResult: IAsyncResult 9 | { 10 | public object AsyncState 11 | { 12 | get; 13 | set; 14 | } 15 | 16 | public System.Threading.WaitHandle AsyncWaitHandle 17 | { 18 | get; 19 | set; 20 | } 21 | 22 | public bool CompletedSynchronously 23 | { 24 | get; 25 | set; 26 | } 27 | 28 | public bool IsCompleted 29 | { 30 | get; 31 | set; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/TestHtml.textContent.txt: -------------------------------------------------------------------------------- 1 |  Hello there 2 | 3 | 4 | ▾ 5 | jamietre 6 | 7 | 3,215 8 | 9 | 10 | 11 | 2 12 | 13 | 14 | 15 | 13 16 | 17 | 18 | 19 | 20 | | 21 | Test textarea
22 | 23 | 24 | 25 | 26 | 27 | Nested hidden span 28 | Nested hidden header 29 | 30 | 31 | 32 | Nested non-hidden span 33 | Nested non=hidden header 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/TextAreaTest.htm: -------------------------------------------------------------------------------- 1 |  2 |
3 | Textarea 4 | 9 | 10 | script 11 | 12 | 17 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/anchor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - Anchor 6 | 7 | 8 |

9 | View Submit Button 10 |

11 | 12 | 13 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/anchor2.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | NIST DOM HTML Test - Anchor 7 | 8 | 9 |

10 | View Submit Button 11 |

12 | 13 | 14 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/anchor3.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | NIST DOM HTML Test - Anchor 7 | 8 | 9 |

10 | View Submit Button 11 |

12 | 13 | 14 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/applet.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - Applet 6 | 7 | 8 |

9 | 10 |

11 | 12 | 13 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/applet2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - Applet 6 | 7 | 8 |

9 | 10 |

11 | 12 | 13 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/area.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - Area 6 | 7 | 8 |

9 | 10 | Domain 11 | 12 |

13 | 14 | 15 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/area2.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | NIST DOM HTML Test - Area 7 | 8 | 9 |

10 | 11 | Domain 12 | 13 |

14 | 15 | 16 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | NIST DOM HTML Test - Base 7 | 8 | 9 |

Some Text

10 | 11 | 12 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/base2.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | NIST DOM HTML Test - Base2 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/basefont.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - BaseFont 6 | 7 | 8 |

9 | 10 |

11 | 12 | 13 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/body.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - Body 6 | 7 | 8 |

Hello, World

9 | 10 | 11 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/br.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - BR 6 | 7 | 8 |

9 |
10 |

11 | 12 | 13 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/button.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - Button 6 | 7 | 8 |
9 |

10 | 11 |

12 |
13 | 14 | 15 | 18 | 19 |
16 | 17 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/directory.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - Directory 6 | 7 | 8 | 9 |
  • DIR item number 1.
  • 10 |
  • DIR item number 2.
  • 11 |
  • DIR item number 3.
  • 12 |
    13 | 14 | 15 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/div.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - DIV 6 | 7 | 8 |
    The DIV element is a generic block container. This text should be centered.
    9 | 10 | 11 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/dl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - DL 6 | 7 | 8 |
    9 |
    Accountant
    10 |
    56,000
    11 |
    Female
    12 |
    1230 North Ave. Dallas, Texas 98551
    13 |
    14 | 15 | 16 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/fieldset.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - FieldSet 6 | 7 | 8 |
    9 |
    10 | All data entered must be valid 11 |
    12 |
    13 | 14 | 15 | 20 | 21 |
    16 |
    17 | All data entered must be valid 18 |
    19 |
    22 | 23 | 24 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/font.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - Font 6 | 7 | 8 | Test Tables 9 | 10 | 11 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/form.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - FORM 6 | 7 | 8 |
    9 |

    10 | 11 | 12 | 13 |

    14 |
    15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/form2.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | NIST DOM HTML Test - FORM 7 | 8 | 9 |
    10 |

    11 | 12 | 13 | 14 |

    15 |
    16 | 17 | 18 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/form3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | FORM3 6 | 7 | 8 |
    9 |

    10 | 11 | 12 | 13 |

    14 |
    15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/frame.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | NIST DOM HTML Test - FRAME 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/frame2.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | NIST DOM HTML Test - FRAME2 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/frameset.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | NIST DOM HTML Test - FRAMESET 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - HEAD 6 | 7 | 8 |

    Hello, World.

    9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/heading.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - HEADING 6 | 7 | 8 |

    Head Element 1

    9 |

    Head Element 2

    10 |

    Head Element 3

    11 |

    Head Element 4

    12 |
    Head Element 5
    13 |
    Head Element 6
    14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/hr.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - HR 6 | 7 | 8 |
    9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/html.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - Html 6 | 7 | 8 |

    Hello, World.

    9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/iframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - IFRAME 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/iframe2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - IFRAME2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/img.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - IMG 6 | 7 | 8 |

    9 | DTS IMAGE LOGO 10 |

    11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/img/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/source/CsQuery.Tests/Resources/jsdom/Level2/img/right.png -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/img/w3c_main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/source/CsQuery.Tests/Resources/jsdom/Level2/img/w3c_main.png -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/isindex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - ISINDEX 6 | 7 | 8 |
    9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/js/script1.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/source/CsQuery.Tests/Resources/jsdom/Level2/js/script1.js -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/label.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - LABEL 6 | 7 | 8 |
    9 |

    10 | 11 | 12 |

    13 |
    14 |

    15 | 16 | 17 |

    18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/legend.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - LEGEND 6 | 7 | 8 |
    9 |
    10 | Enter Password1: 11 | 12 |
    13 |
    14 |
    15 | Enter Password2: 16 | 17 |
    18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/li.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - LI 6 | 7 | 8 |
      9 |
    1. EMP0001 10 |
        11 |
      • Margaret Martin 12 |
        13 |
        Accountant
        14 |
        56,000
        15 |
        Female
        16 |
        17 |
      • 18 |
      19 |
    2. 20 |
    21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/link.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - LINK 6 | 7 | 8 | 9 | 10 |

    11 |
    12 |

    13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/link2.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | NIST DOM HTML Test - LINK 7 | 8 | 9 | 10 | 11 |

    12 |
    13 |

    14 | 15 | 16 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/map.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - MAP 6 | 7 | 8 |

    9 | 10 | Domain1 11 | Domain2 12 | Domain3 13 | 14 |

    15 | 16 | 17 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/menu.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - MENU 6 | 7 | 8 | 9 |
  • Interview
  • 10 |
  • Paperwork
  • 11 |
  • Give start date
  • 12 |
    13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/meta.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - META 6 | 7 | 8 |

    9 |
    10 |

    11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/mod.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - MOD 6 | 7 | 8 |

    9 | The INS element is used to indicate that a section of a document had been inserted. 10 |
    11 | The DEL element is used to indicate that a section of a document had been removed. 12 |

    13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/object.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - OBJECT 6 | 7 | 8 |

    9 | 10 |

    11 |
    12 |

    13 | 14 |

    15 |
    16 | 17 | 18 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/object2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - OBJECT 6 | 7 | 8 |

    9 | 10 |

    11 |
    12 |

    13 | 14 |

    15 |
    16 | 17 | 18 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/olist.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - OLIST 6 | 7 | 8 |
      9 |
    1. EMP0001 10 |
        11 |
      • Margaret Martin 12 |
        13 |
        Accountant
        14 |
        56,000
        15 |
        16 |
      • 17 |
      18 |
    2. 19 |
    3. EMP0002 20 |
        21 |
      • Martha Raynolds 22 |
        23 |
        Secretary
        24 |
        35,000
        25 |
        26 |
      • 27 |
      28 |
    4. 29 |
    30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/optgroup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - OPTGROUP 6 | 7 | 8 |
    9 |

    10 | 21 |

    22 |
    23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/option.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - OPTION 6 | 7 | 8 |
    9 |

    10 | 17 |

    18 |
    19 |

    20 | 27 |

    28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/optionscollection.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - OPTIONSCOLLECTION 6 | 7 | 8 |
    9 |

    10 | 17 |

    18 |
    19 |

    20 | 27 |

    28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/paragraph.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - PARAGRAPH 6 | 7 | 8 |

    9 | TEXT 10 |

    11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/param.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - PARAM 6 | 7 | 8 |

    9 | 10 | 11 | 12 |

    13 | 14 | 15 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/pre.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - PRE 6 | 7 | 8 |
    The PRE is used to indicate pre-formatted text.  Visual agents may:
     9 | 
    10 |                 leave white space intact.
    11 |                 May render text with a fixed-pitch font.
    12 |                 May disable automatic word wrap.
    13 |                 Must not disable bidirectional processing.
    14 | 
    15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/quote.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - QUOTE 6 | 7 | 8 |

    9 | The Q element is intended for short quotations 10 |

    11 |
    12 |

    The BLOCKQUOTE element is used for long quotations.

    13 |
    14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/source/CsQuery.Tests/Resources/jsdom/Level2/right.png -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/script.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - SCRIPT 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/select.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - SELECT 6 | 7 | 8 |
    9 |

    10 | 17 |

    18 |
    19 |

    20 | 27 |

    28 |

    29 | 36 |

    37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/style.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | NIST DOM HTML Test - STYLE 7 | 8 | 9 |

    Hello, World.

    10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/table1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - TABLE 6 | 7 | 8 | 9 | 10 |
    HTML can't abide empty table
    11 | 12 | 13 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/tablecaption.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - TABLECAPTION 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
    CAPTION 1
    Employee IdEmployee NamePositionSalary
    17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/tablecell.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - TABLECELL 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
    Employee IdEmployee NamePositionSalary
    EMP0001Margaret MartinAccountant56,000
    22 | 23 | 24 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/tablecol.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - TABLECOL 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
    IdNamePositionSalary
    EMP0001MartinAccountant56,000
    25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/textarea.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - TEXTAREA 6 | 7 | 8 |
    9 |

    10 | 11 | 12 | 13 |

    14 |
    15 |

    16 | 17 | 18 | 19 | 20 | 21 | 22 |

    23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/title.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - TITLE 6 | 7 | 8 |

    9 |
    10 |

    11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/ulist.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NIST DOM HTML Test - ULIST 6 | 7 | 8 |
      9 |
    1. EMP0001 10 |
        11 |
      • Margaret Martin 12 |
        13 |
        Accountant
        14 |
        56,000
        15 |
        Female
        16 |
        1230 North Ave. Dallas, Texas 98551
        17 |
        18 |
      • 19 |
      20 |
    2. 21 |
    3. EMP0002 22 |
        23 |
      • Martha Raynolds 24 |
        25 |
        Secretary
        26 |
        35,000
        27 |
        Female
        28 |
        1900 Dallas Road. Dallas, Texas 98554
        29 |
        30 |
      • 31 |
      32 |
    4. 33 |
    34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/Resources/jsdom/Level2/w3c_main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/source/CsQuery.Tests/Resources/jsdom/Level2/w3c_main.png -------------------------------------------------------------------------------- /source/CsQuery.Tests/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/jsdom/JsdomTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Tests.jsdom 7 | { 8 | public abstract class JsDomTest : CsQueryTest 9 | { 10 | protected abstract string Root { get; } 11 | protected IDomDocument Load(string file) 12 | { 13 | return TestDom("jsdom\\" + Root + "\\" + file + ".html").Document; 14 | } 15 | } 16 | 17 | 18 | public abstract class JsDomTest_Level2 : JsDomTest 19 | { 20 | 21 | protected override string Root 22 | { 23 | get { return "Level2"; } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/CsQuery.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /source/CsQuery/CQ_CsQuery/FirstElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using CsQuery.Utility; 7 | using CsQuery.ExtensionMethods; 8 | using CsQuery.ExtensionMethods.Internal; 9 | using CsQuery.Engine; 10 | using CsQuery.Implementation; 11 | 12 | namespace CsQuery 13 | { 14 | public partial class CQ 15 | { 16 | /// 17 | /// The first IDomElement (e.g. not text/special nodes) in the selection set, or null if none 18 | /// exists. 19 | /// 20 | /// 21 | /// 22 | /// An IDomElement object. 23 | /// 24 | 25 | public IDomElement FirstElement() 26 | { 27 | 28 | using (IEnumerator sequence = Elements.GetEnumerator()) 29 | { 30 | if (sequence.MoveNext()) 31 | { 32 | return sequence.Current; 33 | } 34 | else 35 | { 36 | return null; 37 | } 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/CsQuery/CQ_CsQuery/HasAttr.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using CsQuery.Utility; 7 | using CsQuery.ExtensionMethods; 8 | using CsQuery.ExtensionMethods.Internal; 9 | using CsQuery.Engine; 10 | using CsQuery.Implementation; 11 | using CsQuery.HtmlParser; 12 | 13 | namespace CsQuery 14 | { 15 | public partial class CQ 16 | { 17 | 18 | /// 19 | /// Test for the existence of an attribute. 20 | /// 21 | /// 22 | /// 23 | /// The name of the attribute to get. 24 | /// 25 | /// 26 | /// 27 | /// A string of the attribute value, or null if the attribute does not exist. 28 | /// 29 | 30 | public bool HasAttr(string name) 31 | { 32 | if (Length > 0 && !string.IsNullOrEmpty(name)) 33 | { 34 | return this[0].HasAttribute(name); 35 | } 36 | return false; 37 | } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /source/CsQuery/CQ_CsQuery/IncludeWhen.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using CsQuery.Utility; 7 | using CsQuery.ExtensionMethods; 8 | using CsQuery.ExtensionMethods.Internal; 9 | using CsQuery.Engine; 10 | using CsQuery.Implementation; 11 | 12 | namespace CsQuery 13 | { 14 | public partial class CQ 15 | { 16 | 17 | 18 | /// 19 | /// Conditionally includes a selection. This is the equivalent of calling Remove() only when 20 | /// "include" is false. 21 | /// 22 | /// 23 | /// 24 | /// true to include, false to exclude. 25 | /// 26 | /// 27 | /// 28 | /// The current CQ object 29 | /// 30 | 31 | public CQ IncludeWhen(bool include) 32 | { 33 | if (!include) 34 | { 35 | Remove(); 36 | } 37 | return this; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /source/CsQuery/CQ_CsQuery/Save.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.IO; 7 | using CsQuery.Utility; 8 | using CsQuery.ExtensionMethods; 9 | using CsQuery.ExtensionMethods.Internal; 10 | using CsQuery.Engine; 11 | using CsQuery.Implementation; 12 | 13 | namespace CsQuery 14 | { 15 | public partial class CQ 16 | { 17 | /// 18 | /// Save the current Document to an HTML file. 19 | /// 20 | /// 21 | /// 22 | /// A new CQ object. 23 | /// 24 | 25 | public void Save(string fileName, DomRenderingOptions renderingOptions=DomRenderingOptions.Default) 26 | { 27 | File.WriteAllText(fileName, Render(renderingOptions)); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/CsQuery/CQ_CsQuery/Version.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Reflection; 7 | using CsQuery.Utility; 8 | using CsQuery.ExtensionMethods; 9 | using CsQuery.ExtensionMethods.Internal; 10 | using CsQuery.Engine; 11 | using CsQuery.Implementation; 12 | 13 | namespace CsQuery 14 | { 15 | public partial class CQ 16 | { 17 | /// 18 | /// Return the current assembly's version. 19 | /// 20 | /// 21 | /// 22 | /// A string 23 | /// 24 | 25 | public static string Version() 26 | { 27 | return typeof(CQ).Assembly.GetName().Version.ToString(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/CsQuery/CQ_jQuery/AndSelf.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using CsQuery.Utility; 7 | using CsQuery.ExtensionMethods; 8 | using CsQuery.ExtensionMethods.Internal; 9 | using CsQuery.Engine; 10 | using CsQuery.Implementation; 11 | 12 | namespace CsQuery 13 | { 14 | public partial class CQ 15 | { 16 | 17 | /// 18 | /// Add the previous set of elements on the stack to the current set. 19 | /// 20 | /// 21 | /// 22 | /// A new CQ object. 23 | /// 24 | /// 25 | /// 26 | /// http://api.jquery.com/andself/ 27 | /// 28 | 29 | public CQ AndSelf() 30 | { 31 | var csq = NewInstance(this); 32 | csq.Order = SelectionSetOrder.Ascending; 33 | 34 | if (CsQueryParent == null) 35 | { 36 | return csq; 37 | } 38 | else 39 | { 40 | csq.SelectionSet.AddRange(CsQueryParent.SelectionSet); 41 | return csq; 42 | } 43 | } 44 | 45 | 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/CsQuery/CQ_jQuery/Empty.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using CsQuery.Utility; 7 | using CsQuery.ExtensionMethods; 8 | using CsQuery.ExtensionMethods.Internal; 9 | using CsQuery.Engine; 10 | using CsQuery.Implementation; 11 | 12 | namespace CsQuery 13 | { 14 | public partial class CQ 15 | { 16 | /// 17 | /// Remove all child nodes of the set of matched elements from the DOM. 18 | /// 19 | /// 20 | /// 21 | /// The current CQ object. 22 | /// 23 | /// 24 | /// 25 | /// http://api.jquery.com/empty/ 26 | /// 27 | 28 | public CQ Empty() 29 | { 30 | 31 | return Each((IDomObject e) => 32 | { 33 | if (e.HasChildren) 34 | { 35 | e.ChildNodes.Clear(); 36 | } 37 | }); 38 | } 39 | 40 | 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /source/CsQuery/CQ_jQuery/End.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using CsQuery.Utility; 7 | using CsQuery.ExtensionMethods; 8 | using CsQuery.ExtensionMethods.Internal; 9 | using CsQuery.Engine; 10 | using CsQuery.Implementation; 11 | 12 | namespace CsQuery 13 | { 14 | public partial class CQ 15 | { 16 | /// 17 | /// End the most recent filtering operation in the current chain and return the set of matched 18 | /// elements to its previous state. 19 | /// 20 | /// 21 | /// 22 | /// The CQ object at the root of the current chain, or a new, empty selection if this CQ object 23 | /// is the direct result of a Create() 24 | /// 25 | /// 26 | /// 27 | /// http://api.jquery.com/end/ 28 | /// 29 | 30 | public CQ End() 31 | { 32 | return CsQueryParent ?? NewCqInDomain(); 33 | } 34 | 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/CsQuery/Config/enumStartupOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// Flags for specifying initial configuration behavior of CsQuery. 10 | /// 11 | 12 | [Flags] 13 | public enum StartupOptions 14 | { 15 | 16 | /// 17 | /// When true, CsQuery will scan the client assembly for extensions. Any classes 18 | /// found in a namespace CsQuery.Extensions will be configured automatically. Default is true; 19 | /// disable this flag to disable this behavior 20 | /// 21 | 22 | LookForExtensions = 1 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /source/CsQuery/CsQuery.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/source/CsQuery/CsQuery.snk -------------------------------------------------------------------------------- /source/CsQuery/Documentation/Architecture.md: -------------------------------------------------------------------------------- 1 | ###Architecture (notes) 2 | 3 | Namespaces 4 | 5 | CsQuery 6 | CsQuery.Engine CSS selection engine 7 | CsQuery.Engine.PseudoClassSelectors Implemenation of mose pseudoclass selectors. 8 | CsQuery.Implementation Concrete classes 9 | CsQuery.HtmlParser 10 | CsQuery.StringScanner 11 | CsQuery.EquationParser 12 | CsQuery.ExtensionMethodsD:\projects\csharp\CsQuery-mvc\source\CsQuery\Documentation\Changes.md 13 | CsQuery.ExtensionMethods.Forms Include this to add form-posting specific extension methods 14 | CsQuery.ExtensionMethods.Internal 15 | CsQuery.Promises Promises API 16 | 17 | Objects 18 | 19 | CsQuery.CQ 20 | CsQuery.Config Static class for configuration 21 | CsQuery. 22 | CsQuery.Promises.When Static factory for promises -------------------------------------------------------------------------------- /source/CsQuery/Documentation/DifferencesFromJQuery.md: -------------------------------------------------------------------------------- 1 |  2 | ### Important Differences from jQuery 3 | 4 | ##### Option Groups 5 | 6 | jQuery and some browsers consider the first member of an option group to be selected, even if it is not explicitly marked as such. This behaviour has not been implemented. 7 | 8 | -------------------------------------------------------------------------------- /source/CsQuery/Documentation/Todo.md: -------------------------------------------------------------------------------- 1 | INTEGRATION with validator.nu 2 | 3 | THE PROBLEM: 4 | 5 | dom[""].AppendTo("#something"); 6 | 7 | The context of "" is not associated with dom, because it's a fragment. At the same time if we bound it to the DOM, 8 | selectors won't work, because it will use the index. 9 | 10 | We need a way to associate a context for new selectors. Select or [] should always operate against a root context. 11 | 12 | ### Todo (punch list) 13 | 14 | Performance: 15 | -Share a dictionary between styles and attributes; just set a bit flag and use an integer. 16 | -Move indexing from CSSStyleDeclaration into DomElement (like attributes) 17 | -Standarize the interface for CSSStyleDeclaration and AttributeCollection with the browser DOM 18 | 19 | (done) nth-child could be alot more efficient by caching the index postions of all siblings when checking the 1st one. 20 | (done) Cache equations AFTER parsing 21 | 22 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/HtmlElements/IFormAssociatedElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// An element that can be associated with a form during form submission. 10 | /// 11 | /// 12 | /// http://www.w3.org/html/wg/drafts/html/master/forms.html#form-associated-element 13 | /// 14 | public interface IFormAssociatedElement 15 | { 16 | /// 17 | /// The form with which to associate the element. 18 | /// 19 | IHTMLFormElement Form { get; } 20 | } 21 | } -------------------------------------------------------------------------------- /source/CsQuery/Dom/HtmlElements/IFormReassociateableElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// An element that can be associated with a form during form submission. 10 | /// 11 | /// 12 | /// http://www.w3.org/html/wg/drafts/html/master/forms.html#category-form-attr 13 | /// 14 | public interface IFormReassociateableElement : IFormAssociatedElement 15 | { 16 | } 17 | } -------------------------------------------------------------------------------- /source/CsQuery/Dom/HtmlElements/IFormSubmittableElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// An element that can be associated with a form during form submission. 10 | /// 11 | /// 12 | /// http://www.w3.org/html/wg/drafts/html/master/forms.html#category-submit 13 | /// 14 | public interface IFormSubmittableElement : IFormAssociatedElement 15 | { 16 | } 17 | } -------------------------------------------------------------------------------- /source/CsQuery/Dom/HtmlElements/IHTMLButtonElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// An HTML BUTTON element. 10 | /// 11 | /// 12 | /// 13 | /// http://dev.w3.org/html5/markup/button.html 14 | /// 15 | 16 | public interface IHTMLButtonElement : IDomElement, IFormSubmittableElement, IFormReassociateableElement 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/HtmlElements/IHTMLInputElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// An HTML INPUT element. 10 | /// 11 | /// 12 | /// 13 | /// http://dev.w3.org/html5/markup/input.html 14 | /// 15 | 16 | public interface IHTMLInputElement : IDomElement, IFormSubmittableElement, IFormReassociateableElement 17 | { 18 | /// 19 | /// A URL that provides the destination of the hyperlink. If the href attribute is not specified, 20 | /// the element represents a placeholder hyperlink. 21 | /// 22 | 23 | bool Autofocus { get; set; } 24 | 25 | /// 26 | /// Specifies that the element is a required part of form submission. 27 | /// 28 | 29 | bool Required {get;set;} 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/HtmlElements/IHTMLLIElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// An LI element. 10 | /// 11 | /// 12 | /// 13 | /// http://dev.w3.org/html5/spec/single-page.html#the-li-element 14 | /// 15 | 16 | public interface IHTMLLIElement : IDomElement 17 | { 18 | /// 19 | /// A valid integer giving the ordinal value of the list item. 20 | /// 21 | 22 | new int Value { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/HtmlElements/IHTMLLabelElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// A LABEL element. 10 | /// 11 | /// 12 | /// 13 | /// http://dev.w3.org/html5/spec/single-page.html#the-label-element 14 | /// 15 | 16 | public interface IHTMLLabelElement : IDomElement, IFormReassociateableElement 17 | { 18 | /// 19 | /// Gets or sets the for attribute 20 | /// 21 | 22 | string HtmlFor {get;set;} 23 | 24 | /// 25 | /// The control bound to this label 26 | /// 27 | 28 | IDomElement Control { get; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/HtmlElements/IHTMLOptionElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// An HTMLOPTION element 10 | /// 11 | /// http://dev.w3.org/html5/spec/single-page.html#attr-option-disabled 12 | 13 | public interface IHTMLOptionElement : IDomElement 14 | { 15 | /// 16 | /// The form with which the element is associated 17 | /// 18 | 19 | IHTMLFormElement Form {get;} 20 | 21 | /// 22 | /// Gets or sets the label attribute. 23 | /// 24 | 25 | string Label {get;set;} 26 | 27 | //bool DefaultSelected {get;set;} 28 | 29 | // inherited from IDomObject 30 | //bool Selected {get;set;} 31 | 32 | //string Value; 33 | // string Text; 34 | 35 | //int Index { get; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/HtmlElements/IHTMLTextAreaElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// An HTML TEXTAREA element. 10 | /// 11 | /// 12 | /// 13 | /// http://dev.w3.org/html5/markup/textarea.html 14 | /// 15 | 16 | public interface IHTMLTextAreaElement : IDomElement, IFormSubmittableElement, IFormReassociateableElement 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/ICSSStyleRule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// Interface for a CSS style rule. 10 | /// 11 | /// 12 | /// 13 | /// http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleRule 14 | /// 15 | 16 | public interface ICSSStyleRule: ICSSRule 17 | { 18 | /// 19 | /// The textual representation of the selector for the rule set. The implementation may have 20 | /// stripped out insignificant whitespace while parsing the selector. 21 | /// 22 | 23 | string SelectorText { get; set; } 24 | 25 | /// 26 | /// The declaration-block of this rule set. 27 | /// 28 | 29 | ICSSStyleDeclaration Style { get; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/ICssStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// A single CSS style definition. 10 | /// 11 | 12 | public interface ICSSStyle 13 | { 14 | /// 15 | /// The name of the style 16 | /// 17 | 18 | string Name { get; set; } 19 | 20 | /// 21 | /// The type of data contained by this style. 22 | /// 23 | 24 | CSSStyleType Type { get; set; } 25 | 26 | /// 27 | /// Gets or sets a format required by this style 28 | /// 29 | 30 | string Format { get; set; } 31 | 32 | /// 33 | /// The acceptable options for Option-type styles 34 | /// 35 | 36 | HashSet Options { get; set; } 37 | 38 | /// 39 | /// A description of this style. 40 | /// 41 | 42 | string Description { get; set; } 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/IDomCData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// A marker interface for CDATA elements. 10 | /// 11 | 12 | public interface IDomCData : IDomSpecialElement 13 | { 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/IDomComment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// An interface for HTML Comment elements. 10 | /// 11 | 12 | public interface IDomComment : IDomSpecialElement 13 | { 14 | /// 15 | /// Gets or sets a value indicating whether this object is quoted. 16 | /// 17 | 18 | bool IsQuoted { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/IDomContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | 9 | /// 10 | /// Interface for objects that can contain other objects. Note that to allow some consistency with how DOM 11 | /// objects are used in the browser DOM, many methods are part of the base IDomObject interface so that they 12 | /// can be used (and return null/missing data) on elements to which they don't apply. So in actuality the only 13 | /// unique methods are nonstandard ones. 14 | /// 15 | public interface IDomContainer : IDomObject 16 | { 17 | /// 18 | /// An enumeration of clones of the chilren of this object 19 | /// 20 | /// 21 | /// 22 | /// An enumerator 23 | /// 24 | 25 | IEnumerable CloneChildren(); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/IDomDocumentType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// DOCTYPE node 10 | /// 11 | public interface IDomDocumentType : IDomSpecialElement 12 | { 13 | /// 14 | /// Gets the type of the document. 15 | /// 16 | 17 | DocType DocType { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/IDomElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using CsQuery.Output; 6 | 7 | namespace CsQuery 8 | { 9 | /// 10 | /// A regular DOM element 11 | /// 12 | 13 | public interface IDomElement : IDomContainer, IDomIndexedNode 14 | { 15 | /// 16 | /// The element is a block element. 17 | /// 18 | 19 | bool IsBlock { get; } 20 | 21 | /// 22 | /// Returns the HTML for this element, but ignoring children/innerHTML. 23 | /// 24 | /// 25 | /// 26 | /// A string of HTML. 27 | /// 28 | 29 | string ElementHtml(); 30 | 31 | /// 32 | /// Get this element's index only among other elements (e.g. excluding text & other non- 33 | /// element node types) 34 | /// 35 | 36 | int ElementIndex { get; } 37 | 38 | 39 | 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/IDomFragment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// Interface for a fragment. This is content that does not represent a complete HTML document. 10 | /// 11 | 12 | public interface IDomFragment : IDomDocument 13 | { 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/IDomInnerText.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// Special element for the text contents of SCRIPT & TEXTAREA objects. 10 | /// 11 | 12 | public interface IDomInnerText : IDomText 13 | { 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/IDomInvalidElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// An element that will be rendered as text because it was determined to be a mismatched tag 10 | /// 11 | [Obsolete] 12 | public interface IDomInvalidElement : IDomText 13 | { 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/IDomObjectT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// Strongly-typed interface for building typed subclasses of IDomObject. 10 | /// 11 | /// 12 | /// 13 | /// Type of the out. 14 | /// 15 | 16 | public interface IDomObject : IDomObject 17 | { 18 | /// 19 | /// Clone this element. 20 | /// 21 | /// 22 | /// 23 | /// A copy of this element that is not bound to the original. 24 | /// 25 | new T Clone(); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/IDomSpecialElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// Interface for an IDomSpecialElement; and element whose data is contained as non-structured 10 | /// data in the tag itself. 11 | /// 12 | 13 | public interface IDomSpecialElement : IDomObject 14 | { 15 | /// 16 | /// Gets or sets the non-structured data in the tag 17 | /// 18 | 19 | string NonAttributeData { get; set; } 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/IDomText.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// Defines an interface for elements whose defintion (not innerhtml) contain non-tag or attribute formed data 10 | /// 11 | 12 | public interface IDomText : IDomObject 13 | { 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/INodeList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Runtime.CompilerServices; 7 | using CsQuery.Implementation; 8 | 9 | namespace CsQuery 10 | { 11 | /// 12 | /// Interface for node list, a read/write collection of nodes. 13 | /// 14 | 15 | public interface INodeList: IEnumerable, IList, ICollection 16 | { 17 | /// 18 | /// The number of nodes in this INodeList 19 | /// 20 | 21 | int Length { get; } 22 | 23 | /// 24 | /// Get the item at the specified index 25 | /// 26 | /// 27 | /// 28 | /// Zero-based index of the item 29 | /// 30 | /// 31 | /// 32 | /// An item 33 | /// 34 | 35 | IDomObject Item(int index); 36 | 37 | /// 38 | /// Event raised when the NodeList changes 39 | /// 40 | 41 | event EventHandler OnChanged; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/Implementation/CSSStyleChangedArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Implementation 7 | { 8 | /// 9 | /// Arguments for when a style is changed. 10 | /// 11 | 12 | public class CSSStyleChangedArgs : EventArgs 13 | { 14 | /// 15 | /// Constructor. 16 | /// 17 | /// 18 | /// 19 | /// A value indicating whether this object has styles following the change. 20 | /// 21 | 22 | public CSSStyleChangedArgs(bool hasStyleAttribute) 23 | { 24 | HasStyleAttribute = hasStyleAttribute; 25 | } 26 | /// 27 | /// Gets a value indicating whether this object has styles following the change. 28 | /// 29 | 30 | public bool HasStyleAttribute 31 | { 32 | get; 33 | protected set; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/Implementation/CssStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Implementation 7 | { 8 | /// 9 | /// A single CSS style definition. 10 | /// 11 | 12 | public class CssStyle : ICSSStyle 13 | { 14 | /// 15 | /// The name of the style. 16 | /// 17 | 18 | public string Name { get; set; } 19 | 20 | /// 21 | /// The type of data contained by this style. 22 | /// 23 | 24 | public CSSStyleType Type { get; set; } 25 | 26 | /// 27 | /// Gets or sets a format required by this style. 28 | /// 29 | 30 | public string Format { get; set; } 31 | 32 | /// 33 | /// A description of this style. 34 | /// 35 | 36 | public string Description { get; set; } 37 | 38 | /// 39 | /// The acceptable options for Option-type styles. 40 | /// 41 | 42 | public HashSet Options { get; set; } 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/Implementation/HtmlElements/HTMLButtonElement.cs: -------------------------------------------------------------------------------- 1 | using CsQuery.HtmlParser; 2 | 3 | namespace CsQuery.Implementation 4 | { 5 | /// 6 | /// An HTML button element. 7 | /// 8 | 9 | public class HTMLButtonElement : FormSubmittableElement, IHTMLButtonElement 10 | { 11 | /// 12 | /// Default constructor. 13 | /// 14 | 15 | public HTMLButtonElement() 16 | : base(HtmlData.tagBUTTON) 17 | { 18 | } 19 | 20 | /// 21 | /// The value of the "type" attribute. For button elements, this property always returns a 22 | /// lowercase value and defaults to "submit" if there is no type attribute. 23 | /// 24 | /// 25 | /// 26 | /// The type. 27 | /// 28 | 29 | public override string Type 30 | { 31 | get 32 | { 33 | return GetAttribute(HtmlData.attrTYPE, "submit").ToLower(); 34 | } 35 | set 36 | { 37 | base.Type = value; 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/Implementation/HtmlElements/HTMLLIElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using CsQuery.HtmlParser; 6 | using CsQuery.Utility; 7 | 8 | namespace CsQuery.Implementation 9 | { 10 | /// 11 | /// An HTML LI element. 12 | /// 13 | 14 | public class HTMLLIElement : DomElement, IHTMLLIElement 15 | { 16 | /// 17 | /// Default constructor. 18 | /// 19 | 20 | public HTMLLIElement() 21 | : base(HtmlData.tagLI) 22 | { 23 | } 24 | 25 | /// 26 | /// The Value property of this LI element, or zero if it is not set. 27 | /// 28 | 29 | public new int Value 30 | { 31 | get 32 | { 33 | return Support.IntOrZero(GetAttribute(HtmlData.ValueAttrId)); 34 | } 35 | set 36 | { 37 | SetAttribute(HtmlData.ValueAttrId, value.ToString()); 38 | } 39 | } 40 | 41 | 42 | 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/Implementation/HtmlElements/HTMLScriptElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using CsQuery.HtmlParser; 6 | 7 | namespace CsQuery.Implementation 8 | { 9 | /// 10 | /// A SCRIPT 11 | /// 12 | 13 | public class HTMLScriptElement : DomElement 14 | { 15 | /// 16 | /// Default constructor 17 | /// 18 | 19 | 20 | public HTMLScriptElement() 21 | : base(HtmlData.tagSCRIPT) 22 | { 23 | 24 | } 25 | 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/Implementation/HtmlElements/HTMLStyleElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using CsQuery.HtmlParser; 6 | 7 | namespace CsQuery.Implementation 8 | { 9 | /// 10 | /// A STYLE element 11 | /// 12 | 13 | public class HTMLStyleElement : DomElement 14 | { 15 | /// 16 | /// Default constructor 17 | /// 18 | 19 | 20 | public HTMLStyleElement() 21 | : base(HtmlData.tagSTYLE) 22 | { 23 | 24 | } 25 | 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/Implementation/NodeEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Implementation 7 | { 8 | /// 9 | /// Additional information for node events. 10 | /// 11 | 12 | public class NodeEventArgs: EventArgs 13 | { 14 | /// 15 | /// Constructor. 16 | /// 17 | /// 18 | /// 19 | /// The node. 20 | /// 21 | 22 | public NodeEventArgs(IDomObject node) 23 | { 24 | Node = node; 25 | } 26 | 27 | /// 28 | /// The node that was added or removed. 29 | /// 30 | 31 | public IDomObject Node { get; protected set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/Implementation/StyleSheet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Implementation 7 | { 8 | class StyleSheet 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/enumCSSRuleType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// Values that represent CSSRuleType. 10 | /// 11 | 12 | public enum CSSRuleType 13 | { 14 | /// 15 | /// An unknown rule. 16 | /// 17 | UNKNOWN_RULE =0, 18 | /// 19 | /// A CSS Style rule. 20 | /// 21 | STYLE_RULE=1, 22 | /// 23 | /// A character set rule. 24 | /// 25 | CHARSET_RULE=2, 26 | /// 27 | /// An import rule. 28 | /// 29 | IMPORT_RULE=3, 30 | /// 31 | /// A media rule. 32 | /// 33 | MEDIA_RULE=4, 34 | /// 35 | /// A font face rule. 36 | /// 37 | FONT_FACE_RULE=5, 38 | /// 39 | /// A page rule. 40 | /// 41 | PAGE_RULE=6 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /source/CsQuery/Dom/enumDocType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// Values that represent the HTML document type. 10 | /// 11 | 12 | public enum DocType: byte 13 | { 14 | /// 15 | /// Use the default doc type (from CsQuery.Config.DocType). 16 | /// 17 | Default = 0, 18 | /// 19 | /// HTML5 20 | /// 21 | HTML5 = 1, 22 | /// 23 | /// HTML 4 Transitional 24 | /// 25 | HTML4 = 2, 26 | 27 | /// 28 | /// XHTML Transitional 29 | /// 30 | XHTML = 3, 31 | /// 32 | /// An unsupported document type. 33 | /// 34 | Unknown = 4, 35 | /// 36 | /// HTML 4 Strict 37 | /// 38 | HTML4Strict = 5, 39 | 40 | /// 41 | /// XHTML Strict. 42 | /// 43 | XHTMLStrict = 6 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/IDomIndexProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Engine 7 | { 8 | /// 9 | /// Interface for a service locator providing in instance of a DomIndex 10 | /// 11 | 12 | public interface IDomIndexProvider 13 | { 14 | /// 15 | /// Return an instance of a DomIndex class 16 | /// 17 | 18 | IDomIndex GetDomIndex(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/IDomIndexQueue.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using CsQuery.Implementation; 6 | 7 | namespace CsQuery.Engine 8 | { 9 | /// 10 | /// Interface for a DOM index that contains a Queue feature. 11 | /// 12 | public interface IDomIndexQueue 13 | { 14 | /// 15 | /// When true, changes are queued until the next read operation 16 | /// 17 | 18 | bool QueueChanges { get; set; } 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/IDomIndexRanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using CsQuery.Implementation; 6 | 7 | namespace CsQuery.Engine 8 | { 9 | /// 10 | /// Interface for a DOM index that can be queried for a range of elements 11 | /// 12 | public interface IDomIndexRanged 13 | { 14 | 15 | /// 16 | /// Queries the index, returning all matching elements 17 | /// 18 | /// 19 | /// 20 | /// The sub key. 21 | /// 22 | /// 23 | /// The depth. 24 | /// 25 | /// 26 | /// true to include, false to exclude the descendants. 27 | /// 28 | /// 29 | /// 30 | /// An enumerator that allows foreach to be used to process query index in this collection. 31 | /// 32 | 33 | IEnumerable QueryIndex(ushort[] subKey, int depth, bool includeDescendants); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/IDomIndexSimple.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using CsQuery.Implementation; 6 | 7 | namespace CsQuery.Engine 8 | { 9 | /// 10 | /// Interface for a DOM index that is queryable. 11 | /// 12 | 13 | public interface IDomIndexSimple 14 | { 15 | /// 16 | /// Queries the index. 17 | /// 18 | /// 19 | /// 20 | /// The sub key. 21 | /// 22 | /// 23 | /// 24 | /// An enumerator that allows foreach to be used to process query index in this collection. 25 | /// 26 | 27 | IEnumerable QueryIndex(ushort[] subKey); 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/IDomIndexedNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// An marker and interface exposing properties required for a node that should be indexed 10 | /// 11 | 12 | public interface IDomIndexedNode: IDomNode 13 | { 14 | 15 | /// 16 | /// Enumerates index keys in this collection. 17 | /// 18 | /// 19 | /// 20 | /// An enumerator that allows foreach to be used to process index keys in this collection. 21 | /// 22 | 23 | IEnumerable IndexKeys(); 24 | 25 | /// 26 | /// The object that is the target of the index (normally, the object itself) 27 | /// 28 | 29 | IDomObject IndexReference { get; } 30 | 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/IndexOperation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Engine 7 | { 8 | internal enum IndexOperationType 9 | { 10 | /// 11 | /// Adds to the index 12 | /// 13 | Add=1, 14 | /// 15 | /// Remove from the index. 16 | /// 17 | Remove=2, 18 | /// 19 | /// Change the value only. 20 | /// 21 | Change =3 22 | } 23 | 24 | internal struct IndexOperation 25 | { 26 | public IndexOperationType IndexOperationType; 27 | public ushort[] Key; 28 | public IDomObject Value; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/MatchElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Engine 7 | { 8 | /// 9 | /// Wrapper class used by the engine to store info on the selector stack. 10 | /// 11 | internal class MatchElement 12 | { 13 | public MatchElement(IDomElement element) 14 | { 15 | Initialize(element, 0); 16 | } 17 | public MatchElement(IDomElement element, int depth) 18 | { 19 | Initialize(element, depth); 20 | } 21 | protected void Initialize(IDomElement element, int depth) 22 | { 23 | Depth = depth; 24 | Element = element; 25 | } 26 | public int Depth { get; protected set; } 27 | public IDomElement Element { get; protected set; } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/PseudoClassSelectors/IPseudoSelectorFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Engine 7 | { 8 | /// 9 | /// A pseudoselector that filters a list of elements. Most jQuery extensions fall within this 10 | /// category. 11 | /// 12 | 13 | public interface IPseudoSelectorFilter: IPseudoSelector 14 | { 15 | /// 16 | /// Filter only the elements matching this result-list position type selector. 17 | /// 18 | /// 19 | /// 20 | /// The sequence of elements prior to this filter being applied. 21 | /// 22 | /// 23 | /// 24 | /// A sequence of matching elements. 25 | /// 26 | 27 | IEnumerable Filter(IEnumerable selection); 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/PseudoClassSelectors/enumQuotingRule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Engine 7 | { 8 | /// 9 | /// Enumerator of possible quoting rules that determine how parameters for CSS selector functions 10 | /// should be parsed. 11 | /// 12 | 13 | public enum QuotingRule 14 | { 15 | /// 16 | /// The parameter value should never be quoted (e.g. is numeric data, or the function simply doesn't expect quotes). 17 | /// 18 | NeverQuoted = 1, 19 | /// 20 | /// The parameter value should always be quoted. 21 | /// 22 | AlwaysQuoted = 2, 23 | /// 24 | /// The parameter value may be quoted: if the first character is a double- or single-quote, then a matching quote terminates the parameter value.. 25 | /// 26 | OptionallyQuoted = 3 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/PseudoClassSelectors/jQuery/Even.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Engine.PseudoClassSelectors 7 | { 8 | /// 9 | /// Return only odd-numbered elements from the selection 10 | /// 11 | 12 | public class Even : PseudoSelector, IPseudoSelectorFilter 13 | { 14 | /// 15 | /// Filter a sequence of elements, returning only the elements at even-numbered ordinal positions 16 | /// 17 | /// 18 | /// 19 | /// The sequence to filter 20 | /// 21 | /// 22 | /// 23 | /// A sequence of elements 24 | /// 25 | 26 | public IEnumerable Filter(IEnumerable selection) 27 | { 28 | int index = 0; 29 | foreach (var child in selection) 30 | { 31 | if (index % 2 == 0) 32 | { 33 | yield return child; 34 | } 35 | index++; 36 | } 37 | } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/PseudoClassSelectors/jQuery/First.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Engine.PseudoClassSelectors 7 | { 8 | /// 9 | /// Return only odd-numbered elements from the selection 10 | /// 11 | 12 | public class First : PseudoSelector, IPseudoSelectorFilter 13 | { 14 | /// 15 | /// Filter the sequence, returning only the first element. 16 | /// 17 | /// 18 | /// 19 | /// A sequence of elements 20 | /// 21 | /// 22 | /// 23 | /// The first element in the sequence, or an empty sequence if the original sequence is empty. 24 | /// 25 | 26 | public IEnumerable Filter(IEnumerable selection) 27 | { 28 | var first = selection.FirstOrDefault(); 29 | if (first != null) 30 | { 31 | yield return first; 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/PseudoClassSelectors/jQuery/Header.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Engine.PseudoClassSelectors 7 | { 8 | /// 9 | /// The jQuery ":header" selector 10 | /// 11 | 12 | public class Header: PseudoSelectorFilter 13 | { 14 | /// 15 | /// Test whether an element is a header (H1-H6) 16 | /// 17 | /// 18 | /// 19 | /// The element to test. 20 | /// 21 | /// 22 | /// 23 | /// true if it matches, false if not. 24 | /// 25 | 26 | public override bool Matches(IDomObject element) 27 | { 28 | var nodeName = element.NodeName; 29 | return nodeName[0] == 'H' 30 | && nodeName.Length == 2 31 | && nodeName[1] >= '0' 32 | && nodeName[1] <= '6'; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/PseudoClassSelectors/jQuery/Hidden.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using CsQuery.HtmlParser; 6 | 7 | namespace CsQuery.Engine.PseudoClassSelectors 8 | { 9 | /// 10 | /// A pseudoselector that returns elements that are hidden. Visibility is defined by CSS: a 11 | /// nonzero opacity, a display that is not "hidden", and the absence of zero-valued width & 12 | /// heights. Additionally, input elements of type "hidden" are always considered not visible. 13 | /// 14 | 15 | public class Hidden: PseudoSelectorFilter 16 | { 17 | /// 18 | /// Test whether an element is hidden. 19 | /// 20 | /// 21 | /// 22 | /// The element to test. 23 | /// 24 | /// 25 | /// 26 | /// true if it matches, false if not. 27 | /// 28 | 29 | public override bool Matches(IDomObject element) 30 | { 31 | return !Visible.IsVisible(element); 32 | } 33 | 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/PseudoClassSelectors/jQuery/Last.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Engine.PseudoClassSelectors 7 | { 8 | /// 9 | /// Return only the last element from a selection 10 | /// 11 | 12 | public class Last : PseudoSelector, IPseudoSelectorFilter 13 | { 14 | /// 15 | /// Filter for the last element in the selection set 16 | /// 17 | /// 18 | /// 19 | /// The sequence of elements prior to this filter being applied. 20 | /// 21 | /// 22 | /// 23 | /// The last element in the selection. 24 | /// 25 | 26 | public IEnumerable Filter(IEnumerable selection) 27 | { 28 | var last = selection.LastOrDefault(); 29 | if (last != null) 30 | { 31 | yield return last; 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/PseudoClassSelectors/jQuery/Odd.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Engine.PseudoClassSelectors 7 | { 8 | /// 9 | /// Return only odd-numbered elements from the selection 10 | /// 11 | 12 | public class Odd : PseudoSelector, IPseudoSelectorFilter 13 | { 14 | /// 15 | /// Filter the sequence of elements for only those in odd-number ordinal indices 16 | /// 17 | /// 18 | /// 19 | /// The sequence of elements prior to this filter being applied. 20 | /// 21 | /// 22 | /// 23 | /// A sequence of matching elements. 24 | /// 25 | 26 | public IEnumerable Filter(IEnumerable selection) 27 | { 28 | int index = 0; 29 | foreach (var child in selection) 30 | { 31 | if (index % 2 != 0) 32 | { 33 | yield return child; 34 | } 35 | index++; 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/PseudoClassSelectors/jQuery/Parent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Engine.PseudoClassSelectors 7 | { 8 | /// 9 | /// Determines whether the target is a parent. 10 | /// 11 | 12 | public class Parent: PseudoSelectorFilter 13 | { 14 | /// 15 | /// Test whether an element is a parent; e.g. has children. 16 | /// 17 | /// 18 | /// 19 | /// The element to test. 20 | /// 21 | /// 22 | /// 23 | /// true if it matches, false if not. 24 | /// 25 | 26 | public override bool Matches(IDomObject element) 27 | { 28 | 29 | return element.HasChildren ? 30 | !Empty.IsEmpty(element) : 31 | false; 32 | } 33 | 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /source/CsQuery/Engine/enumDomIndexFeatures.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Engine 7 | { 8 | /// 9 | /// Flags specifying the features that a given IndexProvider offers 10 | /// 11 | 12 | [Flags] 13 | public enum DomIndexFeatures 14 | { 15 | /// 16 | /// Index is capable of returning a sequence of elements matching a key 17 | /// 18 | Lookup = 1, 19 | /// 20 | /// Index is capable of returning a range of elements matching a subkey. 21 | /// 22 | Range = 2, 23 | /// 24 | /// Indexes implementing this feature can queue changes to improve performance. When this is true, the QueueChanges method must be implemented. 25 | /// 26 | Queue = 4 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/CsQuery/EquationParser/IEquationParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | // TODO this should be fully commented; however it's not part of the main public API 7 | 8 | #pragma warning disable 1591 9 | #pragma warning disable 1570 10 | 11 | 12 | namespace CsQuery.EquationParser 13 | { 14 | public interface IEquationParser 15 | { 16 | bool TryParse(string text, out IOperand operand); 17 | IOperand Parse(string text); 18 | IOperand Parse(string text) where T : IConvertible; 19 | string Error { get; } 20 | } 21 | public interface IEquationParser : IEquationParser where T : IConvertible 22 | { 23 | bool TryParse(string text, out IOperand operand); 24 | new IOperand Parse(string text); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/CsQuery/EquationParser/ILiteral.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | // TODO this should be fully commented; however it's not part of the main public API 7 | 8 | #pragma warning disable 1591 9 | #pragma warning disable 1570 10 | 11 | 12 | namespace CsQuery.EquationParser 13 | { 14 | public interface ILiteral: IOperand 15 | { 16 | void Set(IConvertible value); 17 | new ILiteral Clone(); 18 | } 19 | public interface ILiteral : IOperand, ILiteral where T : IConvertible 20 | { 21 | void Set(T value); 22 | new ILiteral Clone(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /source/CsQuery/EquationParser/INativeOperation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | // TODO this should be fully commented; however it's not part of the main public API 7 | 8 | #pragma warning disable 1591 9 | #pragma warning disable 1570 10 | 11 | 12 | namespace CsQuery.EquationParser 13 | { 14 | public interface INativeOperation: IFunction 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /source/CsQuery/EquationParser/IOperand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | // TODO this should be fully commented; however it's not part of the main public API 7 | 8 | #pragma warning disable 1591 9 | #pragma warning disable 1570 10 | 11 | 12 | namespace CsQuery.EquationParser 13 | { 14 | public interface IOperand : IConvertible, ICloneable 15 | { 16 | IConvertible Value { get; } 17 | bool IsInteger { get; } 18 | new IOperand Clone(); 19 | } 20 | public interface IOperand : IOperand where T : IConvertible 21 | { 22 | new T Value { get;} 23 | new IOperand Clone(); 24 | 25 | } 26 | 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /source/CsQuery/EquationParser/IOperation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | // TODO this should be fully commented; however it's not part of the main public API 7 | 8 | #pragma warning disable 1591 9 | #pragma warning disable 1570 10 | 11 | namespace CsQuery.EquationParser 12 | { 13 | public interface IOperation: IFunction 14 | { 15 | IList Operators { get; } 16 | void AddOperand(IConvertible operand, bool invert); 17 | /// 18 | /// Replaces the last item 19 | /// 20 | /// 21 | 22 | void ReplaceLastOperand(IOperand operand); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /source/CsQuery/EquationParser/IOperator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | // TODO this should be fully commented; however it's not part of the main public API 7 | 8 | #pragma warning disable 1591 9 | #pragma warning disable 1570 10 | 11 | 12 | namespace CsQuery.EquationParser 13 | { 14 | public interface IOperator: ICloneable 15 | { 16 | void Set(string value); 17 | bool TrySet(string value); 18 | OperationType OperationType { get; } 19 | AssociationType AssociationType { get; } 20 | bool IsInverted { get; } 21 | new IOperator Clone(); 22 | 23 | IOperation GetFunction(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /source/CsQuery/EquationParser/IOrderedDictionary.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.EquationParser 7 | { 8 | /// 9 | /// An interface representing a dictionary that also has intrinsic element order. 10 | /// 11 | /// 12 | /// 13 | /// Type of the key. 14 | /// 15 | /// 16 | /// Type of the value. 17 | /// 18 | 19 | public interface IOrderedDictionary : IDictionary, IList>, ICollection>, IEnumerable> 20 | { 21 | /// 22 | /// Obtain the zero-based index of the given key. 23 | /// 24 | /// 25 | /// 26 | /// The key. 27 | /// 28 | /// 29 | /// 30 | /// The zero-based index of the key in the ordered dictionary 31 | /// 32 | 33 | int IndexOf(TKey key); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/CsQuery/EquationParser/IVariable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using CsQuery.EquationParser.Implementation; 6 | 7 | // TODO this should be fully commented; however it's not part of the main public API 8 | 9 | #pragma warning disable 1591 10 | #pragma warning disable 1570 11 | 12 | 13 | namespace CsQuery.EquationParser 14 | { 15 | public interface IVariable : IOperand, IVariableContainer 16 | { 17 | /// 18 | /// The name of this variable 19 | /// 20 | string Name { get; } 21 | // void Clear(); 22 | event EventHandler OnGetValue; 23 | new IVariable Clone(); 24 | } 25 | public interface IVariable : IOperand, IVariable where T : IConvertible 26 | { 27 | Type Type { get; } 28 | /// 29 | /// Release stored value for this variable, causing it to be re-read from the owner 30 | /// 31 | new IVariable Clone(); 32 | //IVariable CloneAs() where U : IConvertible; 33 | new T Value { get; set; } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /source/CsQuery/EquationParser/IVariableContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | // TODO this should be fully commented; however it's not part of the main public API 7 | 8 | #pragma warning disable 1591 9 | #pragma warning disable 1570 10 | 11 | 12 | namespace CsQuery.EquationParser 13 | { 14 | public interface IVariableContainer 15 | { 16 | IEnumerable Variables {get;} 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/CsQuery/EquationParser/Implementation/Types.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.EquationParser.Implementation 7 | { 8 | 9 | interface IIntegerValue : IComparable, IConvertible, 10 | IEquatable, IEquatable, IEquatable, 11 | IEquatable, IEquatable, 12 | IEquatable, IEquatable, 13 | IEquatable, IEquatable, 14 | IComparable, IComparable, IComparable, 15 | IComparable, IComparable, 16 | IComparable, IComparable 17 | { 18 | 19 | } 20 | interface INumericValue : IIntegerValue, 21 | IComparable, IComparable, IComparable, 22 | IEquatable, IEquatable, IEquatable 23 | { 24 | 25 | } 26 | interface ITextValue : IComparable, IConvertible, 27 | IComparable, IComparable, 28 | IEquatable, IEquatable 29 | { 30 | 31 | } 32 | interface IBooleanValue : IComparable, IConvertible, 33 | IComparable, IEquatable 34 | { 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/CsQuery/EquationParser/Implementation/VariableReadEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | // TODO this should be fully commented; however it's not part of the main public API 7 | 8 | #pragma warning disable 1591 9 | #pragma warning disable 1570 10 | 11 | namespace CsQuery.EquationParser.Implementation 12 | { 13 | public class VariableReadEventArgs : EventArgs 14 | { 15 | public VariableReadEventArgs(string name) 16 | { 17 | Name = name; 18 | } 19 | public IConvertible Value 20 | { 21 | get 22 | { 23 | return _Value; 24 | } 25 | set 26 | { 27 | _Value = value; 28 | } 29 | } 30 | protected IConvertible _Value; 31 | 32 | public Type Type 33 | { 34 | get; 35 | set; 36 | } 37 | public string Name 38 | { 39 | get; 40 | protected set; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /source/CsQuery/EquationParser/enumAssociation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.EquationParser 7 | { 8 | /// 9 | /// Values that represent AssociationType; which determines how to group adjacent operands when 10 | /// parsing an equation. 11 | /// 12 | 13 | public enum AssociationType 14 | { 15 | /// 16 | /// Associate with other Addition operands 17 | /// 18 | Addition= 1, 19 | /// 20 | /// associate with other Multiplcation operands 21 | /// 22 | Multiplicaton =2, 23 | /// 24 | /// never associate, associate only directly adjacent operands. 25 | /// 26 | Power = 3, 27 | /// 28 | /// never associate, and use parenthesized operands. 29 | /// 30 | Function = 4 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /source/CsQuery/EquationParser/enumOperationType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.EquationParser 7 | { 8 | /// 9 | /// Values that represent OperationType for an arithmetic operator. 10 | /// 11 | 12 | public enum OperationType 13 | { 14 | /// 15 | /// Addition or + 16 | /// 17 | Addition=1, 18 | /// 19 | /// Subtraction or -. 20 | /// 21 | Subtraction=2, 22 | /// 23 | /// Multiplication or *. 24 | /// 25 | Multiplication=3, 26 | /// 27 | /// Division or /. 28 | /// 29 | Division=4, 30 | /// 31 | /// Modulus or %. 32 | /// 33 | Modulus = 5, 34 | /// 35 | /// Power or ^. 36 | /// 37 | Power=6 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/CsQuery/HtmlParser/Deprecated/enumInsertionMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.HtmlParser.Deprecated 7 | { 8 | 9 | public enum InsertionMode : byte 10 | { 11 | Default = 0, 12 | Script = 1, 13 | Text = 2, 14 | Invalid = 3 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /source/CsQuery/HtmlParser/Deprecated/enumTokenizerState.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Text; 4 | 5 | namespace CsQuery.HtmlParser.Deprecated 6 | { 7 | /// 8 | /// Values that represent the current state of the tokenizer for an IterationData object 9 | /// 10 | 11 | public enum TokenizerState : byte 12 | { 13 | /// 14 | /// The normal (default) state; means content / looking for tags. 15 | /// 16 | 17 | Default = 0, 18 | 19 | /// 20 | /// The tokenizer is inside an opening tag and parsing attributes. 21 | /// 22 | 23 | TagStart = 1, 24 | 25 | /// 26 | /// The tokenizer is finished parsing this node. 27 | /// 28 | 29 | Finished = 2 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/CsQuery/HtmlParser/enumHtmlParsingMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// The methodology applied when parsing strings of HTML 10 | /// 11 | 12 | public enum HtmlParsingMode : byte 13 | { 14 | 15 | /// 16 | /// Automatically detect the document type. When no DocType node is provided, will default to FragmentWithSelfClosingTags. 17 | /// 18 | 19 | Auto = 0, 20 | 21 | /// 22 | /// A fragment whose context is determined by the first tag. 23 | /// 24 | 25 | Fragment = 1, 26 | 27 | /// 28 | /// A content block, assumed to be in BODY context. 29 | /// 30 | 31 | Content = 2, 32 | 33 | /// 34 | /// A complete document; the HTML and BODY tag constructs will be addded if missing.. 35 | /// 36 | 37 | Document = 3 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/CsQuery/HtmlParser/enumHtmlParsingOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery 7 | { 8 | /// 9 | /// The options used when parsing strings of HTML 10 | /// 11 | 12 | [Flags] 13 | public enum HtmlParsingOptions : byte 14 | { 15 | /// 16 | /// No options applied. 17 | /// 18 | 19 | None=0, 20 | 21 | /// 22 | /// Default options (from Config.HtmlParsingOptions) are applied. 23 | /// 24 | 25 | Default=1, 26 | 27 | /// 28 | /// Tags may be self-closing. 29 | /// 30 | 31 | AllowSelfClosingTags=2, 32 | 33 | 34 | /// 35 | /// Comments are ignored entirely. 36 | /// 37 | 38 | IgnoreComments=4 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /source/CsQuery/Implementation/IRangeSortedDictionary.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Implementation 7 | { 8 | /// 9 | /// A sorted dictionary that allows lookup by range. 10 | /// 11 | interface IRangeSortedDictionary : IDictionary 12 | { 13 | /// 14 | /// Return all keys starting with subKey 15 | /// 16 | /// The substring to match 17 | /// 18 | IEnumerable GetRangeKeys(TKey[] subKey); 19 | 20 | /// 21 | /// Return all values having keys beginning with subKey 22 | /// 23 | /// 24 | /// 25 | IEnumerable GetRange(TKey[] subKey); 26 | 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/CsQuery/Implementation/IReadOnlyCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace CsQuery.Implementation 8 | { 9 | /// 10 | /// Interface for read only collection. 11 | /// 12 | /// 13 | /// 14 | /// Generic type parameter. 15 | /// 16 | 17 | public interface IReadOnlyCollection : IEnumerable, IEnumerable 18 | { 19 | /// 20 | /// Gets the number of items in the collection. 21 | /// 22 | 23 | int Count {get;} 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /source/CsQuery/Implementation/IReadOnlyList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace CsQuery.Implementation 8 | { 9 | /// 10 | /// Interface for read only list. 11 | /// 12 | /// 13 | /// 14 | /// Generic type parameter. 15 | /// 16 | 17 | public interface IReadOnlyList : IReadOnlyCollection, IEnumerable, IEnumerable 18 | { 19 | /// 20 | /// Indexer to get items within this collection using array index syntax. 21 | /// 22 | /// 23 | /// 24 | /// Zero-based index of the entry to access. 25 | /// 26 | /// 27 | /// 28 | /// The indexed item. 29 | /// 30 | 31 | T this[int index] { get; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /source/CsQuery/Implementation/enumSelectionSetOrder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Implementation 7 | { 8 | /// 9 | /// Orders in which the selection set can be arranged. Ascending and Descending refer to to the 10 | /// DOM element order. 11 | /// 12 | 13 | public enum SelectionSetOrder 14 | { 15 | /// 16 | /// The items should be returned in the order they were added to the selection set. 17 | /// 18 | OrderAdded = 1, 19 | /// 20 | /// The items should be returned in the order they appear in the DOM. 21 | /// 22 | Ascending = 2, 23 | /// 24 | /// The items should be returned in the reverse order they appear in the DOM. 25 | /// 26 | Descending = 3 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/CsQuery/Output/HtmlEncoderNone.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.IO; 6 | 7 | namespace CsQuery.Output 8 | { 9 | /// 10 | /// Minimum HTML encoder. This only parses the absolute minimum required for correct 11 | /// interpretation (less-than, greater-than, ampersand). Everthing else is passed through. 12 | /// 13 | 14 | public class HtmlEncoderNone: IHtmlEncoder 15 | { 16 | /// 17 | /// Encodes text as HTML, writing the processed output to the TextWriter. 18 | /// 19 | /// 20 | /// 21 | /// The text to be encoded. 22 | /// 23 | /// 24 | /// The target for the ouput. 25 | /// 26 | 27 | public void Encode(string text, TextWriter output) 28 | { 29 | output.Write(text); 30 | } 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /source/CsQuery/Output/IHtmlEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.IO; 6 | 7 | namespace CsQuery.Output 8 | { 9 | /// 10 | /// Interface for HTML encoder/decoder 11 | /// 12 | 13 | public interface IHtmlEncoder 14 | { 15 | /// 16 | /// Encodes text as HTML, writing the processed output to the TextWriter. 17 | /// 18 | /// 19 | /// 20 | /// The text to be encoded. 21 | /// 22 | /// 23 | /// The target for the ouput 24 | /// 25 | 26 | void Encode(string text, TextWriter output); 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/CsQuery/Output/IOutputFormatter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.IO; 6 | using CsQuery.Implementation; 7 | 8 | namespace CsQuery.Output 9 | { 10 | /// 11 | /// Interface for an OutputFormatter. This is an object that renders a CsQuery tree to a TextWriter 12 | /// 13 | 14 | public interface IOutputFormatter 15 | { 16 | /// 17 | /// Renders this object to the passed TextWriter 18 | /// 19 | /// 20 | /// 21 | /// The node. 22 | /// 23 | /// 24 | /// The writer. 25 | /// 26 | 27 | void Render(IDomObject node, TextWriter writer); 28 | 29 | /// 30 | /// Renders this object and returns the output as a string 31 | /// 32 | /// 33 | /// 34 | /// The node. 35 | /// 36 | /// 37 | /// 38 | /// A string of HTML 39 | /// 40 | 41 | string Render(IDomObject node); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /source/CsQuery/README-compilation.md: -------------------------------------------------------------------------------- 1 | #####CsQuery Compilation Options 2 | 3 | threadsafe Build CQ object in threadsafe way (not tested much) 4 | 5 | -------------------------------------------------------------------------------- /source/CsQuery/StringScanner/IStringInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.StringScanner 7 | { 8 | /// 9 | /// Interface that describes characterstics of a string 10 | /// 11 | 12 | public interface IStringInfo : IValueInfo 13 | { 14 | /// 15 | /// The string is a valid HTML attribute name 16 | /// 17 | 18 | bool HtmlAttributeName { get; } 19 | 20 | /// 21 | /// The string contains alpha characters. 22 | /// 23 | 24 | bool HasAlpha { get; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/CsQuery/StringScanner/IValueInfoT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.StringScanner 7 | { 8 | /// 9 | /// Interface for a strongly typed IValueInfo 10 | /// 11 | /// 12 | /// 13 | /// The type of value 14 | /// 15 | 16 | public interface IValueInfo : IValueInfo where T : IConvertible 17 | { 18 | /// 19 | /// The target of the tests. 20 | /// 21 | 22 | new T Target { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /source/CsQuery/StringScanner/Scanner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.StringScanner 7 | { 8 | /// 9 | /// Factory for StringScanner objects 10 | /// 11 | 12 | public static class Scanner 13 | { 14 | /// 15 | /// Creates a new StringScanner from a string. 16 | /// 17 | /// 18 | /// 19 | /// The text. 20 | /// 21 | /// 22 | /// 23 | /// A new StringScsanner. 24 | /// 25 | 26 | public static IStringScanner Create(string text) 27 | { 28 | return new Implementation.StringScannerEngine(text); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/CsQuery/Trewtech.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamietre/CsQuery/5a22e28a39c139cbb8170a0eeeee59e73f9e02f9/source/CsQuery/Trewtech.pfx -------------------------------------------------------------------------------- /source/CsQuery/Web/ICsqWebRequestMetadata.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Web 7 | { 8 | /// 9 | /// Data about a web request. 10 | /// 11 | 12 | public interface ICsqWebRequestMetadata 13 | { 14 | /// 15 | /// The time, in milliseconds, after which to abort an incompete request. 16 | /// 17 | 18 | int Timeout { get; set; } 19 | 20 | /// 21 | /// The UserAgent string to present to the remote server. 22 | /// 23 | 24 | string UserAgent { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/CsQuery/Web/IWebRequestInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Web 7 | { 8 | /// 9 | /// Interface representing a WebRequest 10 | /// 11 | 12 | public interface IWebRequestInfo 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /source/CsQuery/Web/enumRequestState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CsQuery.Web 7 | { 8 | /// 9 | /// Values that represent the current CsqWebRequest state. 10 | /// NOT YET IMPLEMENTED 11 | /// 12 | 13 | public enum RequestState 14 | { 15 | /// 16 | /// The request is idle. 17 | /// 18 | Idle = 1, 19 | /// 20 | /// The request is in progress. 21 | /// 22 | Active = 2, 23 | /// 24 | /// The request failed. 25 | /// 26 | Fail = 3, 27 | /// 28 | /// The request . 29 | /// 30 | PartialSuccess = 4, 31 | 32 | /// 33 | /// The request finished successfully. 34 | /// 35 | Success = 5 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/Local.testsettings: -------------------------------------------------------------------------------- 1 |  2 | 3 | These are default test settings for a local test run. 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /source/TraceAndTestImpact.testsettings: -------------------------------------------------------------------------------- 1 |  2 | 3 | These are test settings for Trace and Test Impact. 4 | 5 | 6 | 7 | 8 | 9 | --------------------------------------------------------------------------------