Pull to refresh
0
0
Антон Романов @infinius

User

Send message
Довольно часто использую такой сниппет:

[].forEach.call(document.querySelectorAll('form'), function (input) {
	var table = [];

	console.group('HTMLForm "' + input.name + '": ' + input.action);
		console.log('Element: ', input, '\nName:		' +
			input.name + '\nMethod:	' + input.method.toUpperCase() +
			             '\nAction:	' + input.action || 'null');

		['input', 'textarea', 'select'].forEach(function (control) {
			[].forEach.call(input.querySelectorAll(control), function (node) {
				table.push({
					'Element':      node,
					'Type':         node.type,
					'Name':         node.name,
					'Value':        node.value,
					'Pretty Value': (isNaN(node.value) || node.value === '' ?
						node.value : parseFloat(node.value))
				});
			});
		});

		console.table(table);
	console.groupEnd();
});

Вот ещё нашёл — поиск в строке
var a = 'some string';
if (!~a.search('b')) ...

Information

Rating
Does not participate
Location
Уфа, Башкортостан(Башкирия), Россия
Registered
Activity