How does javascript-php parse the DOM like javascript?

Source: Internet
Author: User
Js is generated for html. For example, I want to verify {code ...} if jquery is used, alert ($ (& #039; # demo_div & #039 ;). attr (& #039; display & #039;). However, if I use php on the server to capture DOM elements in a webpage, then, how can we analyze its css attributes with css? Is there... js born for html? For example, I want to verify

If jquery is used, alert ($ ('# demo_p '). attr ('display'). But how can I capture DOM elements in a webpage using php on the server and analyze its css attributes with css? Are there functions or classes that have been written?

Reply content:

Js is generated for html. For example, I want to verify

If jquery is used, alert ($ ('# demo_p '). attr ('display'). But how can I capture DOM elements in a webpage using php on the server and analyze its css attributes with css? Are there functions or classes that have been written?

Supplement 3:

Please read this question carefully before giving the subject a question "like"Supplement 2AndComment 7 floorTo see if this should be done.

The Y Problem of the landlord can be solved by itself, but the subject should learn a lesson again to find out XY Problem's bad practices.

Supplement 2:

Well, you are the subject!

After a long time, I got two answers: one short, one long, and two long. I mobilized three members to make comments on 6 floors and asked you what to do after a long time !!!

Why didn't you explain your purpose clearly ?!

The typical XY Problem is to seek out your purpose after a long time. Read this article first.

I have read the response of the subject, and almost all the questions are negative. I think you should step on this question again.

You should go back and reflect on it. Read "Wisdom of Inquiry" several more times, and leave less time-consuming guessing games for the community.

Supplement 1:

You may consider using PHP to call a rendering core that only supports HTML + CSS (without js), and then use the rendering result. At least:

  • Properly tolerate small issues in HTML and get a standard tree DOM Structure
  • Accurately process CSS overwrites and obtain any CSS attribute of a specific element.

If you want to achieve root removal, do not just think about doing this in the PHP framework.

To fully meet your needs, simply relying on any PHP library is useless.Any. No. No doubt.

Because of a simple principle: If we analyze only the HTML string text of a webpage, we cannot determine the state of a last attribute of demo_p.

For example, in your example,displayThe attribute is used with additional

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.