How to use div - 10 common examples

To help you get started, we’ve selected a few div examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sagargp / trollicons / extension / trollicons / trollicons.js View on Github external
(function()
{
	jQuery.noConflict();
	var changing = false;
	var nodes = {};

	/* depending on where we are (fb or gmail) define a "replacement node" that we can just use later */
	if (/facebook/.test(window.location.href))
  {
		nodes['div.conversation'] = '.fbChatConvItem .messages span'; // chat messages in the inbox
		nodes['li.webMessengerMessageGroup'] = 'span'; // the docked chat window messages

		var imgNode = (function(key, img)
      {
		  	return "<span style="\&quot;display:none\&quot;">" + key + "</span><img alt="\&quot;:)\&quot;" style="\&quot;background-position:" src="\&quot;&quot;">";
		  });
	}
	else
  {
		console.debug('not facebook');
	}

  /****
   * now do the actual replacement of said node (defined above) 
   ****/
github hyyan / woo-poly-integration / public / js / Cart.js View on Github external
}

			if ( cart_hash &amp;&amp; ( cart_created === null || cart_created === undefined || cart_created === '' ) ) {
				throw 'No cart_created';
			}

			if ( cart_created ) {
				var cart_expiration = ( ( 1 * cart_created ) + day_in_ms ),
					timestamp_now   = ( new Date() ).getTime();
				if ( cart_expiration &lt; timestamp_now ) {
					throw 'Fragment expired';
				}
				cart_timeout = setTimeout( refresh_cart_fragment, ( cart_expiration - timestamp_now ) );
			}

			if ( wc_fragments &amp;&amp; wc_fragments['div.widget_shopping_cart_content'] &amp;&amp; cart_hash === cookie_hash ) {

				$.each( wc_fragments, function( key, value ) {
					$( key ).replaceWith(value);
				});

				$( document.body ).trigger( 'wc_fragments_loaded' );
			} else {
				throw 'No fragment';
			}

            // Refresh when the display language changes
            var prev_pll_lang = sessionStorage.getItem('pll_language'),
                    pll_lang = get_pll_language();

            if (prev_pll_lang === null || prev_pll_lang === undefined || prev_pll_lang === '') {
                prev_pll_lang = '';
github totaljs / framework / test / test-utils.js View on Github external
str = '/logo';
	assert.ok(utils.path(str) === '/logo/', 'utils.path(): ' + str);

	str = '/logo/';
	assert.ok(utils.path(str) === '/logo/', 'utils.path(): ' + str);

	assert.ok(utils.GUID(40).length === 40, 'utils.GUID(40)');

	assert.ok(utils.encode('<b>total.js</b>"&nbsp;') === '&lt;b&gt;total.js&lt;/b&gt;"&amp;nbsp;', 'utils.encode()');
	assert.ok(utils.decode('&lt;b&gt;total.js&lt;/b&gt;&amp;nbsp;') === '<b>total.js</b>&nbsp;', 'utils.decode()');

	var result = utils.parseXML('<div><b>Peter&amp;Janko</b><i style="color:red">Ita'lic</i></div>');

	assert.ok(result['div.b'] === 'Peter&amp;Janko', 'XML Parser 1');
	assert.ok(result['div.i'] === 'Ita\'lic', 'XML Parser 2');
	assert.ok(result['div.i[]'].style === 'color:red', 'XML Parser Attributes');

	result = utils.parseXML('OK');

	obj = { a: '  1  ', b: { a: '    2 '}, c: [' 1 ', '2', [' 3', ' 5  ']]};
	utils.trim(obj);
	assert.ok(JSON.stringify(obj) === '{"a":"1","b":{"a":"2"},"c":["1","2",["3","5"]]}', 'utils.trim()');

	var async = new utils.Async();
	var value = [];

	async.on('error', function(err, name) {
		console.log('ERROR', err, name);
	});

	async.await('0', function(next) {
github totaljs / framework / test / test-utils.js View on Github external
str = '/logo';
	assert.ok(utils.path(str) === '/logo/', 'utils.path(): ' + str);

	str = '/logo/';
	assert.ok(utils.path(str) === '/logo/', 'utils.path(): ' + str);

	assert.ok(utils.GUID(40).length === 40, 'utils.GUID(40)');

	assert.ok(utils.encode('<b>total.js</b>"&nbsp;') === '&lt;b&gt;total.js&lt;/b&gt;"&amp;nbsp;', 'utils.encode()');
	assert.ok(utils.decode('&lt;b&gt;total.js&lt;/b&gt;&amp;nbsp;') === '<b>total.js</b>&nbsp;', 'utils.decode()');

	var result = utils.parseXML('<div><b>Peter&amp;Janko</b><i style="color:red">Ita'lic</i></div>');

	assert.ok(result['div.b'] === 'Peter&amp;Janko', 'XML Parser 1');
	assert.ok(result['div.i'] === 'Ita\'lic', 'XML Parser 2');
	assert.ok(result['div.i[]'].style === 'color:red', 'XML Parser Attributes');

	result = utils.parseXML('OK');

	obj = { a: '  1  ', b: { a: '    2 '}, c: [' 1 ', '2', [' 3', ' 5  ']]};
	utils.trim(obj);
	assert.ok(JSON.stringify(obj) === '{"a":"1","b":{"a":"2"},"c":["1","2",["3","5"]]}', 'utils.trim()');

	var async = new utils.Async();
	var value = [];

	async.on('error', function(err, name) {
		console.log('ERROR', err, name);
	});

	async.await('0', function(next) {
github totaljs / framework / test / test-utils.js View on Github external
assert.ok(utils.getContentType(str) === 'application/octet-stream', 'utils.getContentType(): ' + str);

	str = '/logo';
	assert.ok(utils.path(str) === '/logo/', 'utils.path(): ' + str);

	str = '/logo/';
	assert.ok(utils.path(str) === '/logo/', 'utils.path(): ' + str);

	assert.ok(utils.GUID(40).length === 40, 'utils.GUID(40)');

	assert.ok(utils.encode('<b>total.js</b>"&nbsp;') === '&lt;b&gt;total.js&lt;/b&gt;"&amp;nbsp;', 'utils.encode()');
	assert.ok(utils.decode('&lt;b&gt;total.js&lt;/b&gt;&amp;nbsp;') === '<b>total.js</b>&nbsp;', 'utils.decode()');

	var result = utils.parseXML('<div><b>Peter&amp;Janko</b><i style="color:red">Ita'lic</i></div>');

	assert.ok(result['div.b'] === 'Peter&amp;Janko', 'XML Parser 1');
	assert.ok(result['div.i'] === 'Ita\'lic', 'XML Parser 2');
	assert.ok(result['div.i[]'].style === 'color:red', 'XML Parser Attributes');

	result = utils.parseXML('OK');

	obj = { a: '  1  ', b: { a: '    2 '}, c: [' 1 ', '2', [' 3', ' 5  ']]};
	utils.trim(obj);
	assert.ok(JSON.stringify(obj) === '{"a":"1","b":{"a":"2"},"c":["1","2",["3","5"]]}', 'utils.trim()');

	var async = new utils.Async();
	var value = [];

	async.on('error', function(err, name) {
		console.log('ERROR', err, name);
	});
github totaljs / framework / test / test-utils.js View on Github external
assert.ok(utils.etag(str) === '974', 'utils.etag(): ' + str);

	str = '/logo';
	assert.ok(utils.path(str) === '/logo/', 'utils.path(): ' + str);

	str = '/logo/';
	assert.ok(utils.path(str) === '/logo/', 'utils.path(): ' + str);

	assert.ok(utils.GUID(40).length === 40, 'utils.GUID(40)');

	assert.ok(utils.encode('<b>total.js</b>"&nbsp;') === '&lt;b&gt;total.js&lt;/b&gt;"&amp;nbsp;', 'utils.encode()');
	assert.ok(utils.decode('&lt;b&gt;total.js&lt;/b&gt;&amp;nbsp;') === '<b>total.js</b>&nbsp;', 'utils.decode()');

	var result = utils.parseXML('<div><b>Peter&amp;Janko</b><i style="color:red">Ita'lic</i></div>');

	assert.ok(result['div.b'] === 'Peter&amp;Janko', 'XML Parser 1');
	assert.ok(result['div.i'] === 'Ita\'lic', 'XML Parser 2');
	assert.ok(result['div.i[]'].style === 'color:red', 'XML Parser Attributes');

	result = utils.parseXML('OK');

	obj = { a: '  1  ', b: { a: '    2 '}, c: [' 1 ', '2', [' 3', ' 5  ']]};
	utils.trim(obj);
	assert.ok(JSON.stringify(obj) === '{"a":"1","b":{"a":"2"},"c":["1","2",["3","5"]]}', 'utils.trim()');

	var async = new utils.Async();
	var value = [];

	async.on('error', function(err, name) {
		console.log('ERROR', err, name);
	});
github andreyvital / babel-plugin-global-require / example-webpack / index.js View on Github external
import sum from 'sum'
import div from 'div'
import mul from 'mul'

console.log(sum(2, 2))
console.log(div(10, 5))
console.log(mul(2, 5))
github shadowsocks / shadow-shop / website / wp-content / plugins / woocommerce / assets / js / frontend / cart-fragments.js View on Github external
}

			if ( cart_hash &amp;&amp; ( cart_created === null || cart_created === undefined || cart_created === '' ) ) {
				throw 'No cart_created';
			}

			if ( cart_created ) {
				var cart_expiration = ( ( 1 * cart_created ) + day_in_ms ),
					timestamp_now   = ( new Date() ).getTime();
				if ( cart_expiration &lt; timestamp_now ) {
					throw 'Fragment expired';
				}
				cart_timeout = setTimeout( refresh_cart_fragment, ( cart_expiration - timestamp_now ) );
			}

			if ( wc_fragments &amp;&amp; wc_fragments['div.widget_shopping_cart_content'] &amp;&amp; cart_hash === cookie_hash ) {

				$.each( wc_fragments, function( key, value ) {
					$( key ).replaceWith(value);
				});

				$( document.body ).trigger( 'wc_fragments_loaded' );
			} else {
				throw 'No fragment';
			}

		} catch( err ) {
			refresh_cart_fragment();
		}

	} else {
		refresh_cart_fragment();
github technomile / Heroku-WordPress / wp-content / plugins / woocommerce / assets / js / frontend / cart-fragments.js View on Github external
}

			if ( cart_hash &amp;&amp; ( cart_created === null || cart_created === undefined || cart_created === '' ) ) {
				throw 'No cart_created';
			}

			if ( cart_created ) {
				var cart_expiration = ( ( 1 * cart_created ) + day_in_ms ),
					timestamp_now   = ( new Date() ).getTime();
				if ( cart_expiration &lt; timestamp_now ) {
					throw 'Fragment expired';
				}
				cart_timeout = setTimeout( refresh_cart_fragment, ( cart_expiration - timestamp_now ) );
			}

			if ( wc_fragments &amp;&amp; wc_fragments['div.widget_shopping_cart_content'] &amp;&amp; cart_hash === cookie_hash ) {

				$.each( wc_fragments, function( key, value ) {
					$( key ).replaceWith(value);
				});

				$( document.body ).trigger( 'wc_fragments_loaded' );
			} else {
				throw 'No fragment';
			}

		} catch( err ) {
			refresh_cart_fragment();
		}

	} else {
		refresh_cart_fragment();
github inspireui / mstore / wordpress / wp-content / plugins / woocommerce / assets / js / frontend / cart-fragments.js View on Github external
}

			if ( cart_hash &amp;&amp; ( cart_created === null || cart_created === undefined || cart_created === '' ) ) {
				throw 'No cart_created';
			}

			if ( cart_created ) {
				var cart_expiration = ( ( 1 * cart_created ) + day_in_ms ),
					timestamp_now   = ( new Date() ).getTime();
				if ( cart_expiration &lt; timestamp_now ) {
					throw 'Fragment expired';
				}
				cart_timeout = setTimeout( refresh_cart_fragment, ( cart_expiration - timestamp_now ) );
			}

			if ( wc_fragments &amp;&amp; wc_fragments['div.widget_shopping_cart_content'] &amp;&amp; cart_hash === cookie_hash ) {

				$.each( wc_fragments, function( key, value ) {
					$( key ).replaceWith(value);
				});

				$( document.body ).trigger( 'wc_fragments_loaded' );
			} else {
				throw 'No fragment';
			}

		} catch( err ) {
			refresh_cart_fragment();
		}

	} else {
		refresh_cart_fragment();

div

&lt;Div row&gt; Use flexbox with ease in React! &lt;/Div&gt;

MIT
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis