{"action":"created","issue":{"url":"https://api.github.com/repos/FluentDOM/FluentDOM/issues/40","repository_url":"https://api.github.com/repos/FluentDOM/FluentDOM","labels_url":"https://api.github.com/repos/FluentDOM/FluentDOM/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/FluentDOM/FluentDOM/issues/40/comments","events_url":"https://api.github.com/repos/FluentDOM/FluentDOM/issues/40/events","html_url":"https://github.com/FluentDOM/FluentDOM/issues/40","id":156272282,"number":40,"title":"html treated as xml?","user":{"login":"inquam","id":1265038,"avatar_url":"https://avatars.githubusercontent.com/u/1265038?v=3","gravatar_id":"","url":"https://api.github.com/users/inquam","html_url":"https://github.com/inquam","followers_url":"https://api.github.com/users/inquam/followers","following_url":"https://api.github.com/users/inquam/following{/other_user}","gists_url":"https://api.github.com/users/inquam/gists{/gist_id}","starred_url":"https://api.github.com/users/inquam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inquam/subscriptions","organizations_url":"https://api.github.com/users/inquam/orgs","repos_url":"https://api.github.com/users/inquam/repos","events_url":"https://api.github.com/users/inquam/events{/privacy}","received_events_url":"https://api.github.com/users/inquam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-23T12:46:47Z","updated_at":"2016-06-07T17:07:36Z","closed_at":null,"body":"Back in the day I used phpQuery for altering rendered pages just before they are send to the client. Since that project has been quite silent for a long time I decided to look for something else when I needed the same functionality again. I found a few and FluentDOM was one of them. I tested it along with the two officially supported css selectors.\r\n\r\nI decided to start by benchmarking the same functionality in FluentDOM and phpQuery and was chocked to see that initializing that took a few ms on phpQuery took almost 200ms for FluentDOM.\r\n\r\n    $query = FluentDOM::QueryCss($html);\r\n\r\nAfter a while I figured out that there was a large overhead when it tried to figure out what content it was given that I could get rid of by specifying that it was html I was feeding it with. So if I instead used\r\n\r\n    $fd = FluentDOM::QueryCss($html, 'text/html');\r\n\r\nthe time for initialization was on par with phpQuery.\r\n\r\nSo I started updating some old code that used phpQuery and everything went smoothly. But a few times I ran into a minor issue where it would complain about tag mismatching etc. I was confused since html, contrary to xml, is very loose with this stuff. But then I noticed that when working with the supplied html, internally it was handled as xml and causing these \"errors\" when for instance doing append operations etc.\r\n\r\nOne part of me like that it complains so I can spot any issue and fix it. But another part of me feels its a bit confusing to be able to specify html but yet have it tested against the xml rules.\r\n\r\nIs this by design, by mistake, by bug or just a side affect of libxml and other underlying libraries used?"},"comment":{"url":"https://api.github.com/repos/FluentDOM/FluentDOM/issues/comments/224347729","html_url":"https://github.com/FluentDOM/FluentDOM/issues/40#issuecomment-224347729","issue_url":"https://api.github.com/repos/FluentDOM/FluentDOM/issues/40","id":224347729,"user":{"login":"ThomasWeinert","id":236825,"avatar_url":"https://avatars.githubusercontent.com/u/236825?v=3","gravatar_id":"","url":"https://api.github.com/users/ThomasWeinert","html_url":"https://github.com/ThomasWeinert","followers_url":"https://api.github.com/users/ThomasWeinert/followers","following_url":"https://api.github.com/users/ThomasWeinert/following{/other_user}","gists_url":"https://api.github.com/users/ThomasWeinert/gists{/gist_id}","starred_url":"https://api.github.com/users/ThomasWeinert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThomasWeinert/subscriptions","organizations_url":"https://api.github.com/users/ThomasWeinert/orgs","repos_url":"https://api.github.com/users/ThomasWeinert/repos","events_url":"https://api.github.com/users/ThomasWeinert/events{/privacy}","received_events_url":"https://api.github.com/users/ThomasWeinert/received_events","type":"User","site_admin":false},"created_at":"2016-06-07T17:07:36Z","updated_at":"2016-06-07T17:07:36Z","body":"I already created a branch that includes it. But the new issue #43 is related and changes the plugin api and the content type handling. So I would like to include that into the release.\r\n\r\nYou can change the require to `\"fluentdom/fluentdom\": \"^6.0@dev\"` to test the new version.\r\n\r\n*btw* Here are two possible performance improvements depending on you usecase:\r\n\r\n1. Use Xpath expression. (You can convert CSS to Xpath using http://xpath.thomas.weinert.info/)\r\n\r\nIf you use CSS selectors, the library needs to parse and transform them at runtime. However depending on the knowledge of your team, the Xpath expression might be less readable.\r\n\r\n2. Use FluentDOM::load() (returns FluentDOM\\Document, a DOMDocument child class)\r\n\r\nFluentDOM\\Query works with an array of nodes and has some internal sorting and normalization. FluentDOM\\Document extends the DOM but it works directly on the DOM nodes.  \r\n\r\n"}}
{"actor":{"display_login":"ThomasWeinert"}}