Git Product home page Git Product logo

hast-to-hyperscript's People

Contributors

chandlerprall avatar christianmurphy avatar derhuerst avatar greenkeeperio-bot avatar jamesopstad avatar kerumen avatar kthjm avatar mbrn avatar pd4d10 avatar rokt33r avatar wooorm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hast-to-hyperscript's Issues

HAST node array property value is serialized

This issue is related to #14 regarding the properties of React elements.

My node has properties like:

{
    params: ["param1", "param2", "param3"]
}

These lines in hast-to-hyperscript serializes the array into a string

  if (value !== null && typeof value === 'object' && 'length' in value) {
    // Accept `array`.  Most props are space-separater.
    value = (info.commaSeparated ? commas : spaces).stringify(value)
  }

As was the case with the false values in #14 , when dealing with react elements, I would expect the properties to apply to the react element as-is. So that the react elements receive the actual properties that are present in the HAST.

Would it be possible to not transform the properties in case of react elements?

`node._owner` is too unstable

#4 is insufficient. node._owner is not always null.

ReactElement.js#L259

return ReactElement(
    type,
    key,
    ref,
    self,
    source,
    ReactCurrentOwner.current, // โ† become _owner directry
    props,
  );

ReactCurrentOwner.js

var ReactCurrentOwner = {
  /**
   * @internal
   * @type {ReactComponent}
   */
  current: (null: null | ReactInstance | Fiber),
};

node._owner is so unstable that it is new ReactCompositeComponentWrapper at my local. so can't use it for detect.

React own detect its element by isValidElement function use Symbol, But i don't know whether hast-to-hyperscript relate it better.

sorry for the confusion. my did was superficial.

Cannot set property to false

Hey,

I have html ast which i am parsing, with some of the properties being "false" (bool false not string).
they are boolean properties and i expect them to be either true or false.

After a processing of hast-to-hyperscript, those props are completely gone.

browsing the code abit, ive found those lines:

// Ignore nully, `false`, `NaN`, and falsey known booleans.
if (
value === null ||
value === undefined ||
value === false ||
value !== value ||
(info.boolean && !value)
) {
return
}

(specificlly line 151 (value === false))

which i can understand why would you filter null and undefined, i don't understand why false is being filtered.
looking at the hast github again, i dont see any reasoning for that..

can you please explain this behavior? or maybe that is just a bug?

react(h) fail to work properly in webpack -p

Im using rehype-react, But when bundle with uglify (webpack -p), style attribute stored in hast isn't reflected to view.

I looked it up, It seems the cause is node._store.

to #L174

to #L25

result

: process.env.NODE_ENV === "development" (work)

: process.env.NODE_ENV === "production" (not work)

I don't know why this caused, But parseStyle don't work because r === false.

Add support for Vue

placeholder
I'll use this space for describing what specsare needed to add proper support for Vue.js 2 createElement.
The end goal is to code a remark-vue plugin.

Fix support for base64 encoded url values in styles

Take this example style attribute, it strips the background-image property from the semicolon forward

<span style="padding-bottom: 56.25%; position: relative; bottom: 0; left: 0; background-image: url('data:image/jpeg;base64,/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wgARCAALABQDASIAAhEBAxEB/8QAFwABAQEBAAAAAAAAAAAAAAAAAAEDBf/EABUBAQEAAAAAAAAAAAAAAAAAAAAB/9oADAMBAAIQAxAAAAHtzUkUv//EABkQAQACAwAAAAAAAAAAAAAAAAEAAhASMf/aAAgBAQABBQJsjsw5n//EABQRAQAAAAAAAAAAAAAAAAAAABD/2gAIAQMBAT8BP//EABQRAQAAAAAAAAAAAAAAAAAAABD/2gAIAQIBAT8BP//EABoQAAEFAQAAAAAAAAAAAAAAAAEAICIxMkH/2gAIAQEABj8CMeLJpv8A/8QAGhABAQACAwAAAAAAAAAAAAAAAREAYSBR4f/aAAgBAQABPyEgEyr3g03PMVCk1w//2gAMAwEAAgADAAAAEP8Az//EABQRAQAAAAAAAAAAAAAAAAAAABD/2gAIAQMBAT8QP//EABQRAQAAAAAAAAAAAAAAAAAAABD/2gAIAQIBAT8QP//EABsQAQACAgMAAAAAAAAAAAAAAAERQQAgMVHB/9oACAEBAAE/EBA8AW6MSkU8tPrHcWkqrT//2Q=='); background-size: cover; display: block;">

Which then throws errors in the browser:

GET data:image/jpeg net::ERR_INVALID_URL

I believe the issue is here:

var declarations = value.split(';');

When the styles get separated assuming the separator is a semicolon, which is a valid character in a base64 string.

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.