* Set grid option via control comment
(node, result)
| 503 | * Set grid option via control comment |
| 504 | */ |
| 505 | gridStatus(node, result) { |
| 506 | if (!node) return false |
| 507 | |
| 508 | if (node._autoprefixerGridStatus !== undefined) { |
| 509 | return node._autoprefixerGridStatus |
| 510 | } |
| 511 | |
| 512 | let value = null |
| 513 | if (node.nodes) { |
| 514 | let status |
| 515 | node.each(i => { |
| 516 | if (i.type !== 'comment') return |
| 517 | if (GRID_REGEX.test(i.text)) { |
| 518 | let hasAutoplace = /:\s*autoplace/i.test(i.text) |
| 519 | let noAutoplace = /no-autoplace/i.test(i.text) |
| 520 | if (typeof status !== 'undefined') { |
| 521 | result.warn( |
| 522 | 'Second Autoprefixer grid control comment was ' + |
| 523 | 'ignored. Autoprefixer applies control comments to the whole ' + |
| 524 | 'block, not to the next rules.', |
| 525 | { node: i } |
| 526 | ) |
| 527 | } else if (hasAutoplace) { |
| 528 | status = 'autoplace' |
| 529 | } else if (noAutoplace) { |
| 530 | status = true |
| 531 | } else { |
| 532 | status = /on/i.test(i.text) |
| 533 | } |
| 534 | } |
| 535 | }) |
| 536 | |
| 537 | if (status !== undefined) { |
| 538 | value = status |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | if (node.type === 'atrule' && node.name === 'supports') { |
| 543 | let params = node.params |
| 544 | if (params.includes('grid') && params.includes('auto')) { |
| 545 | value = false |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | if (!node.nodes || value === null) { |
| 550 | if (node.parent) { |
| 551 | let isParentGrid = this.gridStatus(node.parent, result) |
| 552 | if (node.parent._autoprefixerSelfDisabled === true) { |
| 553 | value = false |
| 554 | } else { |
| 555 | value = isParentGrid |
| 556 | } |
| 557 | } else if (typeof this.prefixes.options.grid !== 'undefined') { |
| 558 | value = this.prefixes.options.grid |
| 559 | } else if (typeof process.env.AUTOPREFIXER_GRID !== 'undefined') { |
| 560 | if (process.env.AUTOPREFIXER_GRID === 'autoplace') { |
| 561 | value = 'autoplace' |
| 562 | } else { |
no outgoing calls
no test coverage detected