Giter Club home page Giter Club logo

html-object's People

Contributors

anahkiasen avatar armandomiani avatar claar avatar cwspear avatar mlocati avatar nyholm avatar patrickcarlohickman avatar peter279k avatar petercoles avatar weotch 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

html-object's Issues

Tag?

Please could we have a tag on this project?

Currently former can't be used in any project with minimum stability "stable" as it depends on this project which doesn't have a stable release.

Self-closing meta tag

I see that there is a isSelfClosing property, but no way to alter it as it's protected. I cannot figure out from docs nor code how I would make the meta tag self-close. Is there something I'm missing, or is this not possible in the code's current state?

+ Release

Please can you tag another release.

Suggestion: Sizzle-like selectors

Exactly copy Sizzle's CSS-compatible selector, for have possibility do this:

$element->sizzle('.foo'); // return all tags in any depth with class foo
$element->sizzle('[data-custom=something]'); // filter by attributes
// etc

Symfony CSS selector can be utilized for path parsing procedure.

It seems more developer- and standards-friendly to manipulate HTML nodes structures.

GitHub Actions / Unit test PHP 8.0 to 8.3

Hello @Anahkiasen,

If you plan to continue this project and enable support for PHP >= 8, and/or replace Travis (which free version is no longer available), note that I already setup GitHub Actions on my fork https://github.com/kylekatarnls/html-object and made the needed change to make it compatible with upper versions of PHPUnit. If you wish I propose a pull-request for it after #35 and #36 are merged, please ping me, I would gladly do it.

And thank you for the html-object ๐Ÿ™

Raw value for data()

Is it possible to add raw values to data attributes?
If I pass a JSON string to Former with Former::text('tags', 'Tags')->dataTags($tags);, the data get's encoded
Maybe an extra parameter to specify raw output?

Add Table to Elements

Would like this, but need to be able to make a table from an array. Is this in the roadmap? ... and if so, what is the time line ?

Self-closing elements printing close tag when nesting.

Consider the following snippet:

$formGroup = \HtmlObject\Element::div();
$formGroup->nest(\HtmlObject\Input::text('foo'));

echo htmlentities($formGroup);

What I expect to get printed is:

<div><input type="text" name="foo"></div>

But, what really gets printed is:

Input get printed correctly, if I use it alone htmlentities(\HtmlObject\Input::text('foo'))

<input type="text" name="foo">

The closing tag comes to haunt only when nesting it inside another tag.

After looking through the code, I think the issue can be solved by modifying the code for close function on the Tag class, as follows:

foreach ($this->children as $childName => $child) {
  if ($child->isOpened ) { // <-- change condition to if ($child->isOpened && !$child->isSelfClosing) {
    $openedOn = $childName;
    $element .= $child->close();
  } elseif ($openedOn and $child->isAfter($openedOn)) {
    $element .= $child;
  }
}

The problem is, I am not sure whether this fix will cause any side effects. :(

New version

Can I please request a new version which includes #21 fix. Have been running off a fork for quite some time.

Empty/false attributes

When attributes such as 'checked' and 'disabled' are false in 1.4.1 they are included within the HTML.

1.4.0:

<input type="checkbox" value="1" name="role_15" id="role_15">

1.4.1:

<input type="checkbox" value="1" name="role_15" id="role_15" checked="" disabled="">

This means they are disabled when they shouldn't be.

[Feature] Add `addStyle`

I'd love an addStyle that works similar to addClass. I'm open to making a PR for it if you're interested.

data_foo() behavior changed

From 1.4.2 to 1.4.4 the behavior of data_foo() changed.

1.4.2:
<input data_foo="true" />
1.4.4:
<input data_foo />

I saw that there were some changes about false/empty attributes, if it was intentional then disconsider this issue, otherwise it might be interesting to restore this behavior.

Thanks

Wrong nest() behavior

// add two empty cells into row
$tr->nest('td', '');
$tr->nest('td', '');

// but there is only one
// because it uses empty string as child id o_O
print $tr; // <tr><td></td></tr>

It is easy predictable side-effect โ€” node string content used as node id will fail at second inserted child with same content.

Composer issue

Hey, lately I get this error a lot:

Could not scan for classes inside "/var/www/html/bootstrap/vendor/anahkiasen/html-object/tests" which does not appear to be a file nor a folder

It only seems to happen with your package, do you have any idea why this could happen? When I look in the dir, the test folder is missing. Any idea what could be causing this?
When I rm -rf vendor/anahkiasen and composer update again, it loads this package again from cache, but works..

Self closing tags

The self closing tags don't really work... I changed two lines of code and that seems to fix it:

Tag.php (#109)

$this->isOpened = !$this->isSelfClosing;

Tag.php (#118)

return '<'.$this->element.Helpers::parseAttributes($this->attributes) . ($this->isSelfClosing ? ' /' : ''). '>';

PS: Great library!

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.