-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Component.js Package #8
Comments
Yeah, sorry. This was one of the things i wanted to test before publicizing the project, but someone else found it and spilled the beans before i was ready. I have the fix for this locally already, it just got intermixed with some other changes, so i haven't pushed it yet. I'll branch it and repeat though. I'm not a big component user, so help me out here. Is component pulling it straight from github? or from NPM? |
Ok, i also fixed the path in component.js I've got other things to work on today or i'd go test it myself. If you would, close this case if it's all working for you now. |
Thanks for fixing this so quickly, it's working fine now. The only problem I'm still having is with the HTML.ify() method. I'm trying to use it to parse an html string before I've inserted it into the dom and then use .find etc methods to manipulate nodes within it. It's throwing this error: Btw component pulls straight from github and only the files listed in the component.json. That's how it's so fast. |
One other thing, I keep getting warnings about find() being deprecated and that I should use query() instead. I wasn't sure whether to heed the advice though as the docs always refer to find(). |
I just updated the docs. see issue #7 for why the switch to query() HTML.ify() is for nodes not strings. HTML.js doesn't currently accept actual html input. :) The idea is that you would use the native DOM for that: https://developer.mozilla.org/en-US/docs/Web/API/element.insertAdjacentHTML I've toyed with having add() accept raw html (instead of just tag names and/or emmet abbreviations). But it's hard to see what that would provide except a shorthand version of
|
I suppose it might prove more useful for ify() to accept html strings instead of add(). Then it can return disconnected and HTML'ified nodes from dynamically loaded markup. It would have to be pretty lightweight code though. |
Okay thanks for clarifying all that. I think you're right to keep the library focused, there are other solutions for parsing strings into HTML like domify. On that note, I was going to suggest that you add an extra section to the docs/wiki listing complimentary libraries. Stuff like adding CSS class names to elements is going to be needed by most people I expect so it might be useful to point them in the right direction. There's a bunch of candidates on the component wiki you might want to look at and probably lots more besides. It might also help you decide which areas to focus future development on. Thanks again for creating this, I'm really enjoying using it. |
Yeah, a doc section on complimentary components is a great idea! Wanna submit a pull request? ;) Perhaps we can just start by opening an issue to discuss candidates. For manipulating class names, however, the native classList API is pretty sweet: https://developer.mozilla.org/en-US/docs/Web/API/element.classList It has And of course, you can use http://nbubna.github.io/HTML/#_.resolve aliases to shorten that. |
Those aliases are sweet. I didn't know classList had all that functionality. That's the great thing about this library, it educates you about the real dom API instead of hiding it like jQuery does. It would be cool to get ie9 support as well so still some scope for a polyfill class in the list of complimentary libraries I reckon. I'll make a list of a few and will submit a new issue for it to get some other suggestions. |
Thanks @techjacker! Having even the start of a list of complimentary components (com-coms?) will help. And yeah, we should definitely include a section of polyfills that allow HTML to work better with IE9 (and maybe even an IE8 section?). And yes, one of my main goals with this is to educate people about the DOM API. It's no longer the mess it was. While it can still be verbose or unwieldy in places, it only takes a little sugar like HTML.js and suddenly piping everything through jQuery's completely alternate API feels pretty unnecessary. |
Awesome project.
I've been struggling to get this to work with component though. I thought I'd fixed it when I edited src/component.js to from
require('../dist/HTML.all.js')
torequire('../dist/HTML.js')
. But then I started getting errors about HTML not being defined when the second IIFE tries to execute with HTML as an arg.The text was updated successfully, but these errors were encountered: