GithubHelp home page GithubHelp logo

Comments (10)

g6ling avatar g6ling commented on June 15, 2024

sorry. README is wrong. findSelector is not there. You can use querySelect or getElementsBySelector. I think findSelector is same as getElementsBySelector

from react-native-html-parser.

brandoncc avatar brandoncc commented on June 15, 2024

Okay, querySelect wouldn't work though. When I did querySelect('input[name="authenticity-token"]'), it returned an array of all 6 inputs of any type on the page.

from react-native-html-parser.

g6ling avatar g6ling commented on June 15, 2024

ok.

var DOMParser = require('../dom-parser').DOMParser;
var doc = new DOMParser().parseFromString(
    '<html><body>'+
    '<div id="a" class="a">'+
        '<a class="b">abcd</a>'+
    '</div>'+
    '<div class="b">'+
        '<a href="aa" id="b">'+
    '</div>'+
    '<input name="abc" />' +
    '<input name="bbb" />' +
    '</body></html>'
    ,'text/html');

console.log(doc.querySelect('input[name="bbb"]').map((elem) => elem.attributes))
console.log('end')

When I tested this code, I got only <input name="bbb" /> element. Could you test this code?

from react-native-html-parser.

brandoncc avatar brandoncc commented on June 15, 2024

Yours works for me. I don't know what the difference is. I am parsing the text returned from a fetch, and this is what I get:

image

As you can see, I only have one in the document, but I get six matches. take a closer look:

image

The first one is named "utf8", not "authenticity_token". The next one is named "email", and it goes on.

from react-native-html-parser.

g6ling avatar g6ling commented on June 15, 2024

Sorry. I don't know why yours cannot work. If you send your HTML and your code, I debug it and fix library.

from react-native-html-parser.

ohtangza avatar ohtangza commented on June 15, 2024

Oh, I also spent some time to figure it out.

from react-native-html-parser.

g6ling avatar g6ling commented on June 15, 2024

@ohtangza Could you give me your html code? If you send it, I will debug it and fix library.

from react-native-html-parser.

ohtangza avatar ohtangza commented on June 15, 2024

@g6ling Oh, your parser basically worked. I just could not find findSelector() in the library. Just a matter of documentation as you mentioned.

Btw, 한국인이시네요? :)

from react-native-html-parser.

g6ling avatar g6ling commented on June 15, 2024

@ohtangza thanks. I fixed it. f8a61b1

네 반갑습니다 :)

from react-native-html-parser.

ohtangza avatar ohtangza commented on June 15, 2024

@g6ling Thanks for your effort. Cheers!

from react-native-html-parser.

Related Issues (16)

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.