santiycr / cssify Goto Github PK
View Code? Open in Web Editor NEWXPATH to CSS translator
License: MIT License
XPATH to CSS translator
License: MIT License
I provide input and there's nothing in the output...
Hello,
I've got some problem with your translator when it translates something like "table[3]" into "table:nth(3)".
Could you modify your source to change the keyword "nth" to "nth-of-type" ?
Thank you for your support,
Pierre-François Bonnefoi.
//sgswidget//a[contains(@href,'dashboard/profile')]
is translated proprely: 'sgswidget a[href*=dashboard/profile]'
current behaviour:
just add a dash to sgswidget
//sgs-widget//a[contains(@href,'dashboard/profile')]
and you will get the error:
cssify.cssify.XpathException: Invalid or unsupported Xpath: //sgs-widget//a[contains(@href,'dashboard/profile')]
expected condition:
//sgs-widget//a[contains(@href,'dashboard/profile')]
should be traslated properly to:
'sgs-widget a[href*=dashboard/profile]'
a = "//a[contains(@href,'attestation-upload')]"
cssify(a)
output:
a[href*=attestation-upload]
expected condition:
in this case proper css selector, or the more accurate selector would be one with quoted value:
a[href*='attestation-upload']
I believe there should be an elegant way to make it happen
Hi @santiycr,
What is the license for this project?
Can I use and rewrite this code in my open source project if I cite you as an original author?
:contains
pseudo-class is very incompatible with browsers (also deprecated in CSS3) so I've removed it from the script but some more xpathes can be safely converted. See my port for example.
Sup! Thank you for lib, but now we can't use it cause of bug with indexes. When I put xpath with index more than 9:
cssify("/li[10]")
# cssify.cssify.XpathException: Invalid or unsupported Xpath: /li[10]
Expected behaviour is:
cssify("/li[10]")
# 'li:nth-of-type(10)'
Hi
The tool doesn't support xpath property which elements not contains attribute
eg.
span[not(contains(@Attribute,"value_string"))] should convert to --> span:not([attribute*=value_string])
thank you!
Simple xpaths results in 'not supported'. I even tried your example
'//a[@id="bleh"]'
I am using cssify and ran into a problem with some rather unusual html elements, which the package doesn't not (yet) recognise. And I was wondering if this could be implemented.
For example when you visit this webpage in incognito, you'll get a cookie notice for which you can see an html element:
<wsp-consent-modal class="consent-modal" consent-choices="third-party-cookies,crm,browse-data" consent-version="5"> ...... </wsp-consent-modal>
Thanks in advance for any help!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.