Coder Social home page Coder Social logo

element.details's Introduction

A pure JS polyfill for details tag with DOM API for all browsers including IE6+

Status: Beta 2

Demo: http://jsbin.com/eyopiy/5

Using

<!--[if lt IE 8]>
<script src=Element.details.ielt8.js"></script>
<![endif]-->
<!--[if IE 8]>
<script src="Element.details.ie8.js"></script>
<![endif]-->
<!--[if gt IE 8]><!-->
<script src="Element.details.js"></script>
<!--<![endif]-->

DOM API

var details = document.querySelector("details");
details.open = true;
details.open = false;

CSS selector for 'details marker'

detail .details-marker { <some> }
[or] detail>*>.details-marker { <some> }

summary::-webkit-details-marker { <some> }
summary::-moz-details-marker { <some> }
summary::-o-details-marker { <some> }
summary::details-marker { <some> }

##Use with dynamic HTML DOM API:

Array.from(document.querySelectorAll('details')).forEach(function(el){
	el.open = el.open
})

jQuery:

$("details").each(function(k, el) {
	el.open = el.open;
})

##Features

  • DOM API (Extend Node.prototype with "open" property)
  • No libs need (almost)
  • Create element (instead of fake which can be styled in css) when
    without
  • Wrap text nodes into custom element instead of (which can be styled in css)
  • IE6 and IE7 support with some tweaks

##Limitations

  1. Require:
  2. No animation support for now

Browser support

  • All browsers including IE8
  • IE7,IE6 only support with Element.details.ielt8.htc file in the root of youre site

IE < 8

  • Problem: Property open has the same name as Attribute open -> rename attribute to "$OPEN$"

TODO

  1. Listeners (open/close)

element.details's People

Watchers

 avatar  avatar

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.