Giter Site home page Giter Site logo

Does not work with HTML about cloud-to-butt HOT 6 CLOSED

hakre avatar hakre commented on July 24, 2024
Does not work with HTML

from cloud-to-butt.

Comments (6)

DaveRandom avatar DaveRandom commented on July 24, 2024

That's going to be difficult to sort out in a cross-browser manner, it's reasonably easy to look for adjacent text nodes but you'd probably need to ignore <div>the</div> cloud (block-level elements, in other words) and innerText/textContent are a) a pain in my butt (heh) and b) will screw up the HTML semantics if you modify them

from cloud-to-butt.

hakre avatar hakre commented on July 24, 2024

Naturally the HTML semantics must be preserved, but it is not possible with split words like:

<i>th</i>e cloud

true. However just thinking that running an xpath query that returns all text-nodes (maybe even that contain (case-insensitively) the search words) might improve the code. This would spare to do the tree traversal with a recursive js function.

from cloud-to-butt.

DaveRandom avatar DaveRandom commented on July 24, 2024

XPath has more restricted browser support, but that is still probably a feasible solution. I agreed the complete document tree traversal is dangerous, and could affect the UX.

from cloud-to-butt.

panicsteve avatar panicsteve commented on July 24, 2024

I'm not personally going to go to that much effort for a butt joke, but I encourage any and all forks.

from cloud-to-butt.

DaveRandom avatar DaveRandom commented on July 24, 2024

@panicsteve You clearly underestimate just how far we will go to avoid doing real work.

from cloud-to-butt.

moeffju avatar moeffju commented on July 24, 2024

I fixed this in my fork at https://github.com/moeffju/cloud-to-butt, which Iā€™m currently extending for multi-language support.

from cloud-to-butt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.