* Check for control comment and global options
(node, result)
| 384 | * Check for control comment and global options |
| 385 | */ |
| 386 | disabled(node, result) { |
| 387 | if (!node) return false |
| 388 | |
| 389 | if (node._autoprefixerDisabled !== undefined) { |
| 390 | return node._autoprefixerDisabled |
| 391 | } |
| 392 | |
| 393 | if (node.parent) { |
| 394 | let p = node.prev() |
| 395 | if (p && p.type === 'comment' && IGNORE_NEXT.test(p.text)) { |
| 396 | node._autoprefixerDisabled = true |
| 397 | node._autoprefixerSelfDisabled = true |
| 398 | return true |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | let value = null |
| 403 | if (node.nodes) { |
| 404 | let status |
| 405 | node.each(i => { |
| 406 | if (i.type !== 'comment') return |
| 407 | if (/(!\s*)?autoprefixer:\s*(off|on)/i.test(i.text)) { |
| 408 | if (typeof status !== 'undefined') { |
| 409 | result.warn( |
| 410 | 'Second Autoprefixer control comment ' + |
| 411 | 'was ignored. Autoprefixer applies control ' + |
| 412 | 'comment to whole block, not to next rules.', |
| 413 | { node: i } |
| 414 | ) |
| 415 | } else { |
| 416 | status = /on/i.test(i.text) |
| 417 | } |
| 418 | } |
| 419 | }) |
| 420 | |
| 421 | if (status !== undefined) { |
| 422 | value = !status |
| 423 | } |
| 424 | } |
| 425 | if (!node.nodes || value === null) { |
| 426 | if (node.parent) { |
| 427 | let isParentDisabled = this.disabled(node.parent, result) |
| 428 | if (node.parent._autoprefixerSelfDisabled === true) { |
| 429 | value = false |
| 430 | } else { |
| 431 | value = isParentDisabled |
| 432 | } |
| 433 | } else { |
| 434 | value = false |
| 435 | } |
| 436 | } |
| 437 | node._autoprefixerDisabled = value |
| 438 | return value |
| 439 | } |
| 440 | |
| 441 | /** |
| 442 | * Check for grid/flexbox options. |
no outgoing calls
no test coverage detected