Skip to content

Commit

Permalink
Replace 'iff' with 'if and only if'
Browse files Browse the repository at this point in the history
  • Loading branch information
krozycki committed Jul 21, 2016
1 parent 00b6c96 commit f7659eb
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 23 deletions.
6 changes: 4 additions & 2 deletions src/lib/custom-style.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@
this.__appliedElement.__cssBuild = this.__cssBuild;
}
// needed becuase elements in imports do not get 'attached'
// TODO(sorvell): we could only do this iff this.ownerDocument != document;
// TODO(sorvell): we could only do this if and only if
// this.ownerDocument != document;
// however, if we do that, we also have to change the `attached`
// code to go at `_beforeAttached` time because this is when
// elements produce styles (otherwise this breaks @apply shim)
Expand All @@ -144,7 +145,8 @@

_tryApply: function() {
if (!this._appliesToDocument) {
// only apply variables iff this style is not inside a dom-module
// only apply variables if and only if this style is not inside
// a dom-module
if (this.parentNode &&
(this.parentNode.localName !== 'dom-module')) {
this._appliesToDocument = true;
Expand Down
21 changes: 11 additions & 10 deletions src/lib/dom-api-shady.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
},

// cases in which we may not be able to just do standard native call
// 1. container has a shadyRoot (needsDistribution IFF the shadyRoot
// has an insertion point)
// 1. container has a shadyRoot (needsDistribution if and only if the
// shadyRoot has an insertion point)
// 2. container is a shadyRoot (don't distribute, instead set
// container to container.host.
// 3. node is <content> (host of container needs distribution)
Expand All @@ -55,7 +55,7 @@
throw Error('The ref_node to be inserted before is not a child ' +
'of this node');
}
// remove node from its current position iff it's in a tree.
// remove node from its current position if and only if it's in a tree.
if (node.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) {
var parent = TreeApi.Logical.getParentNode(node);
// notify existing parent that this node is being removed.
Expand Down Expand Up @@ -87,15 +87,15 @@
},

// Try to add node. Record logical info, track insertion points, perform
// distribution iff needed. Return true if the add is handled.
// distribution if and only if needed. Return true if the add is handled.
_addNode: function(node, ref_node) {
var root = this.getOwnerRoot();
if (root) {
// note: we always need to see if an insertion point is added
// since this saves logical tree info; however, invalidation state
// needs
var ipAdded = this._maybeAddInsertionPoint(node, this.node);
// invalidate insertion points IFF not already invalid!
// invalidate insertion points if and only if not already invalid!
if (!root._invalidInsertionPoints) {
root._invalidInsertionPoints = ipAdded;
}
Expand All @@ -110,7 +110,8 @@
// if shady is handling this node,
// the actual dom may not be removed if the node or fragment contents
// remain undistributed so we ensure removal here.
// NOTE: we only remove from existing location iff shady dom is involved.
// NOTE: we only remove from existing location if and only if shady dom is
// involved.
// This is because a node fragment is passed to the native add method
// which expects to see fragment children. Regular elements must also
// use this check because not doing so causes separation of
Expand Down Expand Up @@ -154,8 +155,8 @@
return node;
},

// Try to remove node: update logical info and perform distribution iff
// needed. Return true if the removal has been handled.
// Try to remove node: update logical info and perform distribution if and
// only if needed. Return true if the removal has been handled.
// note that it's possible for both the node's host and its parent
// to require distribution... both cases are handled here.
_removeNode: function(node) {
Expand All @@ -165,10 +166,10 @@
var distributed;
var root = this._ownerShadyRootForNode(node);
if (logicalParent) {
// distribute node's parent iff needed
// distribute node's parent if and only if needed
distributed = dom(node)._maybeDistributeParent();
TreeApi.Logical.recordRemoveChild(node, logicalParent);
// remove node from root and distribute it iff needed
// remove node from root and distribute it if and only if needed
if (root && this._removeDistributedChildren(root, node)) {
root._invalidInsertionPoints = true;
this._lazyDistribute(root.host);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/experimental/patch-dom.html
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@

// NOTE: patch logical implementations here so we can use
// composed getters
// TODO(sorvell): may need to patch saveChildNodes iff the tree has
// TODO(sorvell): may need to patch saveChildNodes if and only if the tree has
// already been distributed.
TreeApi.Logical.recordInsertBefore = function(node, container, ref_node) {
container.__dom.childNodes = null;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/template/dom-if.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<script>

/**
* Stamps the template iff the `if` property is truthy.
* Stamps the template if and only if the `if` property is truthy.
*
* When `if` becomes falsey, the stamped content is hidden but not
* removed from dom. When `if` subsequently becomes truthy again, the content
Expand Down
2 changes: 1 addition & 1 deletion src/mini/shady.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
Polymer.Base._addFeature({

_prepShady: function() {
// Use this system iff localDom is needed.
// Use this system if and only if localDom is needed.
this._useContent = this._useContent || Boolean(this._template);
},

Expand Down
4 changes: 2 additions & 2 deletions src/standard/gestures.html
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@
// first move is 'start', subsequent moves are 'move', mouseup is 'end'
self.info.state = self.info.started ? (e.type === 'mouseup' ? 'end' : 'track') : 'start';
if (self.info.state === 'start') {
// iff tracking, always prevent tap
// if and only if tracking, always prevent tap
Gestures.prevent('tap');
}
self.info.addMove({x: x, y: y});
Expand Down Expand Up @@ -586,7 +586,7 @@
var x = ct.clientX, y = ct.clientY;
if (this.hasMovedEnough(x, y)) {
if (this.info.state === 'start') {
// iff tracking, always prevent tap
// if and only if tracking, always prevent tap
Gestures.prevent('tap');
}
this.info.addMove({x: x, y: y});
Expand Down
2 changes: 1 addition & 1 deletion src/standard/styling.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
styleTransformer.elementStyles(this);
// prepare to shim style properties.
this._prepStyleProperties();
// apply static styles iff
// apply static styles if and only if
// no custom properties are used (otherwise
// styles are applied via property shimming)
if (!this._needsStyleProperties() && cssText){
Expand Down
10 changes: 5 additions & 5 deletions src/standard/x-styling.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
this._customStyle = null;
},

// TODO(dfreedm): should only be true iff browser doesn't support
// native custom properties.
// TODO(dfreedm): should only be true if and only if browser doesn't
// support native custom properties.
_needsStyleProperties: function() {
return Boolean(!nativeVariables && this._ownStylePropertyNames &&
this._ownStylePropertyNames.length);
Expand Down Expand Up @@ -226,8 +226,8 @@
value = host._scopeElementClass(node, value);
}
}
// note: using Polymer.dom here ensures that any attribute sets
// will provoke distribution if necessary; do this iff necessary
// note: using Polymer.dom here ensures that any attribute sets will
// provoke distribution if necessary; do this if and only if necessary
node = (this.shadyRoot && this.shadyRoot._hasDistributed) ?
Polymer.dom(node) : node;
serializeValueToAttribute.call(this, value, attribute, node);
Expand Down Expand Up @@ -263,7 +263,7 @@
if (nativeVariables) {
propertyUtils.updateNativeStyleProperties(this, this.customStyle);
} else {
// actually process styling changes iff attached
// actually process styling changes if and only if attached
if (this.isAttached) {
// skip applying properties to self if not used
if (this._needsStyleProperties()) {
Expand Down

0 comments on commit f7659eb

Please sign in to comment.